小编给大家分享一下html怎么实现点击button页面跳转,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!方法:1、使用onclick事件,在标签内添加“onclick="window.location.href=
小编给大家分享一下html怎么实现点击button页面跳转,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
方法:1、使用onclick事件,在标签内添加“onclick="window.location.href=地址"”即可;2、在button标签外套一个a标签,在a标签中用href属性添加跳转代码。
本教程操作环境:windows7系统、css3&&HTML5版、Dell G3电脑。
方法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页面跳转”有了一定的了解,如果想了解更多相关知识,欢迎关注编程网精选频道,感谢各位的阅读!
--结束END--
本文标题: HTML怎么实现点击button页面跳转
本文链接: https://www.lsjlt.com/news/279159.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-07
2024-05-07
2024-05-07
2024-05-07
2024-05-07
2024-05-07
2024-05-07
2024-05-07
2024-05-07
2024-05-07
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0