您的位置:首页 > 其它

使用a标签和button标签实现页面的跳转再跳回来

2017-02-16 15:04 423 查看
主页面
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>页面的跳转</title><!--修改a标签的样式--><style type="text/css">
	/*顺序需要注意*/#testColor{text-decoration: none;}#testColor:link{color: #000;}#testColor:visited{color: green;}#testColor:hover{color: skyblue;}#testColor:active{color: brown;}</style><script type="application/javascript">window.onload = function(){//使用button进行页面的跳转var button = document.getElementById("button");button.onclick = function(){//                window.open("./跳转目的页面.html");   //target=_blank//                window.location.href = "跳转目的页面.html"; //target=_self//                self.location = "跳转目的页面.html";//                window.navigate("跳转目的页面.html");  //只有IE支持top.location = "跳转目的页面.html";}}</script></head><body><a href="跳转目的页面.html" id="testColor">跳转到目的页面</a><button id="button">使用button跳转</button><br />图片链接:<a href="跳转目的页面.html"><img height="50" width="50" src="../images/2.jpg"alt="图片显示不出来了..."></a></body></html>
目的页面
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>跳转目的页面</title><script type="application/javascript">window.onload = function () {var button = document.getElementById("button");button.onclick = function(){//返回上一页window.history.back(-1);}}</script></head><body>跳转目的页面<button id="button">使用button跳转 返回上一页</button></body></html>

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息