html按钮设置超链接的方法一:使用超链接与button结合的方法
html按钮超链接代码如下:
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <a href=http://www.jb51.cc/> <input type=button value=编程之家网 > </a> </body> </html>
说明:<a> 标签的 href 属性用于指定超链接目标的URL。
html按钮设置超链接的方法二:使用链接和css样式设置将超链接设置成按钮的形状
<!DOCTYPE html> <html> <head> <title></title> <style type=text/css> a.button { -webkit-appearance: button; -moz-appearance: button; appearance: button; text-decoration: none; color: initial; } </style> </head> <body> <a href=http://www.jb51.cc class=button>编程之家网</a> </body> </html>
html按钮设置超链接的方法三:使用 form表单来设置html按钮超链接
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <form method=get action=http://www.jb51.cc/> <button type=submit>编程之家网</button> </form> </body> </html>
html按钮设置超链接的方法四:使用window.location.href方法
完整的写法:
<a href=链接> <input type=button onclick=window.location.href('连接')> </a>
说明:
1、若直接在本页跳转到新的页面,则用: <input type=button onclick=window.location.href('连接')>
2、如果需要打开一个新的页面进行跳转,则用: <input type=button onclick=window.open('连接')>
原文地址:https://www.jb51.cc/html/1207925.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。