本文摘自PHP中文网,作者V,侵删。

方法1:使用onclick事件
1 2 | < input type = "button" value = "按钮"
onclick = "javascrtpt:window.location.href='http://www.baidu.com/'" />
|
或者直接使用button标签
1 | <button onclick= "window.location.href = 'https://www.baidu.com/'" >百度</button>
|
(推荐教程:html教程)
方法2:在button标签外套一个a标签
1 2 3 | <a href= "http://www.baidu.com/" >
<button>百度</button>
</a>
|
或使用
1 | <a href= "http://www.baidu.com/" ><input type= "button" value= '百度' ></a>
|
方法3:使用JavaScript函数
1 2 3 4 5 6 7 8 | <script>
function jump(){
window.location.href= "http://www.baidu.com/" ;
}
</script>
<input type= "button" value= "百度" onclick=javascrtpt:jump() />
|
更多编程相关内容,请关注php中文网编程入门栏目!
以上就是html中通过点击button标签实现页面跳转的三种方法的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
html 5设计原则介绍
html css怎么隐藏滚动条
怎样解决在html中竖列文字竖列显示不全的问题
html悬停时如何改变链接a样式
添加背景音乐的html标签是什么
html是什么?html网页的简单设计方法介绍
html span标签是什么意思?span标签的作用详解
html怎么加入js
html简单介绍
html下拉框怎么做
更多相关阅读请进入《button》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » html中通过点击button标签实现页面跳转的三种方法