300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > HTML/CSS - 点击按钮跳转到新页面

HTML/CSS - 点击按钮跳转到新页面

时间:2020-12-25 22:14:30

相关推荐

HTML/CSS - 点击按钮跳转到新页面

<!DOCTYPE html><html><head><meta charset="utf-8"><title>Title</title><script type="text/javascript">// <script src="外部js文件路径" type="text/javascript">function change_button_text(){// document.getElementById("button2").value = "Success";// document.getElementById("button_2").innerHTML = "Success";document.getElementById("button_2").innerText = "Success";document.getElementById("button_1").innerText = document.getElementsByTagName("a")[0].getAttribute("href");}</script><style type="text/css">button{border-radius: 6px;border:1px solid green;height: 40px;width:200px;background-color: lime;}button:hover{background-color: cyan;}</style></head><body><!-- <button> <a href="">点击我跳转到百度</a></button> --><a href="/" target="_blank"><button id="button_1">快点击我~</button></a><div><button onclick="change_button_text()" id="button_2">在点击我~</button></div></body></html>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。