如何使用js实现基于当前页面的页面跳转功能?
- 内容介绍
- 文章标签
- 相关推荐
本文共计306个文字,预计阅读时间需要2分钟。
js如何实现页面跳转
js页面跳转的几种代码:
1. 使用window.location.href属性跳转:javascriptwindow.location.href='http://www.example.com';
2. 使用window.location对象跳转:javascriptwindow.location='http://www.example.com';
3. 使用history对象跳转:javascripthistory.go(-1); // 返回上一页history.go(1); // 前进一页history.back(); // 等同于history.go(-1)history.forward(); // 等同于history.go(1)
4. 使用setTimeout函数实现延时跳转:javascriptsetTimeout(function() { window.location.href='http://www.example.com';}, 3000); // 3秒后跳转
js如何实现页面跳转_js当前页面跳转文章转载自: js页面跳转的几种代码 www.studyofnet.com/news/185.html页面跳转方式
1.在原来的窗体中直接跳转用
window.location.href=你所要跳转的页面;
window.history.back(-1);返回上一页
window.history.history.back()
window.history.forward()返回下一页
window.history.go(返回第几页,也可以使用访问过的URL)
2、在新窗体中打开页面用:
window.open(你所要跳转的页面);
window.showmodeldialog(你所要跳转的页面)
js页面跳转到父页面、最外层页面、本页面
window.location.href、location.href是本页面跳转;
parent.location.href是上一层页面跳转,也可以使用子窗口的 opener 对象来获得父窗口的对象来实现父窗口的刷新:window.opener.document.location.href;
top.location.href是最外层的页面跳转;
本文共计306个文字,预计阅读时间需要2分钟。
js如何实现页面跳转
js页面跳转的几种代码:
1. 使用window.location.href属性跳转:javascriptwindow.location.href='http://www.example.com';
2. 使用window.location对象跳转:javascriptwindow.location='http://www.example.com';
3. 使用history对象跳转:javascripthistory.go(-1); // 返回上一页history.go(1); // 前进一页history.back(); // 等同于history.go(-1)history.forward(); // 等同于history.go(1)
4. 使用setTimeout函数实现延时跳转:javascriptsetTimeout(function() { window.location.href='http://www.example.com';}, 3000); // 3秒后跳转
js如何实现页面跳转_js当前页面跳转文章转载自: js页面跳转的几种代码 www.studyofnet.com/news/185.html页面跳转方式
1.在原来的窗体中直接跳转用
window.location.href=你所要跳转的页面;
window.history.back(-1);返回上一页
window.history.history.back()
window.history.forward()返回下一页
window.history.go(返回第几页,也可以使用访问过的URL)
2、在新窗体中打开页面用:
window.open(你所要跳转的页面);
window.showmodeldialog(你所要跳转的页面)
js页面跳转到父页面、最外层页面、本页面
window.location.href、location.href是本页面跳转;
parent.location.href是上一层页面跳转,也可以使用子窗口的 opener 对象来获得父窗口的对象来实现父窗口的刷新:window.opener.document.location.href;
top.location.href是最外层的页面跳转;

