<html>
<head>
<script language="javascript"><!--
function old_page()
{
window.location = "http://www.baidu.com"
}
function replace()
{
window.location.replace("http://www.baidu.com")
}
function new_page()
{
window.open("http://www.baidu.com")
}
// --></script>
</head>
<body>
<input type="button" onclick="new_page()" value="new_page"/>
<BR />
<input type="button" onclick="old_page()" value="old_page"/>
<BR />
<input type="button" onclick="replace()" value="replace"/>
</body>
window.location和window.open的区别
window.location = "http://www.baidu.com" 跳转后有后退功能
window.location.replace("http://www.baidu.com") 跳转后没有后退功能
window.open("http://www.baidu.com") 要新的窗口打开链接
本人亲自测试 :window.location.replace 例如Index 和Index2 页面,从Index 页面到Index2页面后在进行后退的时候 可以 把来自
Index2的的返回挡在Index2 页面,不返回Index 页面
转载自:https://blog.csdn.net/xia9527/article/details/7635054
js中实现页面跳转的方法
最新推荐文章于 2025-07-04 15:40:23 发布