有人可以解释为什么我的链接不起作用吗?
<!-- Optional theme this one is ok -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<button type="button" class="btn btn-primary" href="#">Get your Free Quote now!</button>
正确的方法是使用但使用按钮类。
<a href="https://www.google.com" class="btn btn-primary">Get your Free Quote now!</a>
小提琴示例:
https://jsfiddle.net/aq9Laaew/159899/
您可以执行以下操作: 它有效。
<a href="#"><button type="button" class="btn btn-primary">Get your Free Quote now!</button></a>
按钮的设计风格保持不变。
Inline Javascript:
<button onclick="window.location='http://www.example.com';">Visit Page Now</button>
在 Javascript 中定义一个函数:
<script> function visitPage(){ window.location='http://www.example.com'; } </script> <button onclick="visitPage();">Visit Page Now</button>
或在 Jquery 中
<button id="some_id">Visit Page Now</button> $('#some_id').click(function() { window.location='http://www.example.com'; });
在引导程序中,
<button type="button" class="btn btn-primary" onclick="window.location='http://www.example.com';">Get your Free Quote now!</button>