如何使用引导程序将链接放在按钮上? [英] How to put a link on a button with bootstrap?
本文介绍了如何使用引导程序将链接放在按钮上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将链接放在带有引导程序的按钮上?
How would one put a link on a button with bootstrap?
bootstrap 文档中有 4 个方法:
there are 4 methods in the bootstrap documentation:
<a href="#" class="btn btn-info" role="button">Link Button</a>
<button type="button" class="btn btn-info">Button</button>
<input type="button" class="btn btn-info" value="Input Button">
<input type="submit" class="btn btn-info" value="Submit Button">
第一个不适合我,没有按钮显示,只有带有链接的文本,感觉它是我使用的主题.
The first one doesn't work for me, no button shows, just the text with the link, have a feeling its the theme im using.
第二个显示了我想要的按钮,但代码是什么使按钮在点击时链接到另一个页面?
The second one shows the button which is what i want, but whats the code make the button link to another page when clicked?
干杯
推荐答案
可以在按钮的点击事件上调用函数.
You can call a function on click event of button.
<input type="button" class="btn btn-info" value="Input Button" onclick=" relocate_home()">
<script>
function relocate_home()
{
location.href = "www.yoursite.com";
}
</script>
或使用此代码
<a href="#link" class="btn btn-info" role="button">Link Button</a>
这篇关于如何使用引导程序将链接放在按钮上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文