本篇文章和大家了解一下html中如何通过点击button标签实现页面跳转。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。

方法1:使用onclick事件

<input type="button" value="按钮"onclick="javascrtpt:window.location.href='http://www.baidu.com/'" />

或者直接使用button标签

<button onclick="window.location.href = 'https://www.baidu.com/'">百度</button>

方法2:在button标签外套一个a标签

<a href="http://www.baidu.com/"> <button>百度</button></a>

或使用

<a href="http://www.baidu.com/"><input type="button" value='百度'></a>

方法3:使用JavaScript函数

<script>function jump(){ window.location.href="http://www.baidu.com/";}</script><input type="button" value="百度" onclick=javascrtpt:jump() />// 或者<input type="button" value="百度" onclick="jump()" />// 或者<button onclick="jump()">百度</button>

以上就是html中如何通过点击button标签实现页面跳转的简略介绍,当然详细使用上面的不同还得要大家自己使用过才领会。如果想了解更多,欢迎关注亿速云行业资讯频道哦!