温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

html按钮如何设置超链接

发布时间:2020-09-26 15:19:21 来源:亿速云 阅读:343 作者:小新 栏目:web开发

html按钮如何设置超链接?这个问题可能是我们日常学习或工作经常见到的。希望通过这个问题能让你收获颇深。下面是小编给大家带来的参考内容,让我们一起来看看吧!

html按钮设置超链接的方法一:使用超链接与button结合的方法

html按钮超链代码如下:

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<a href="http://www.php.cn/">
<input type=button value="亿速云" >
</a>
</body>
</html>

说明:<a> 标签的 href 属性用于指定超链接目标的URL。

html按钮设置超链接的方法二:使用链接和css样式设置将超链接设置成按钮的形状

html按钮超链接代码如下:

<!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.php.cn" class="button">亿速云</a>
</body>
</html>

html按钮设置超链接的方法三:使用 form表单来设置html按钮超链接

html按钮超链接代码如下:

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<form method="get" action="http://www.php.cn/">
    <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('连接')">

感谢各位的阅读!看完上述内容,你们对html按钮如何设置超链接大概了解了吗?希望文章内容对大家有所帮助。如果想了解更多相关文章内容,欢迎关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI