input 标签和a标签实现超链接的区别


a 标签和 input 标签都可以做链接点击的。代码:

--------------------------------------------------------------------------------------------------------------------------------------------

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>

<input type="button" onclick="location.reload()" value="重置">
<input type="button" onclick="location.href='http://www.baidu.com'" value="百度">
<a href="http://www.baidu.com">百度</a>
</body>
</html>

--------------------------------------------------------------------------------------------------------------------------------------------

 



<input>标签里可以加入onclick 事件 用location的href 实现 与<a>标签实现的外观有区别,但是功能一样!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM