hist .com sessions .net sre style top navi article
- /**
- * 页面跳转与传值
- * http://www.cnblogs.com/cyy-13/p/5775344.html
- * http://www.jb51.net/article/25403.htm
- */
- function testPageJump() {
- debugger;
- // cookie传值
- document.cookie = "AAA=aaa&BBB=bbb";
- // localStorage传值
- localStorage.CCC = "ccc";
- localStorage.setItem("AAA", "aaa");
- // sessionStorage传值
- sessionStorage.setItem("BBB", "bbb");
- // 参数传值
- // 在当前页面打开
- window.location.href = "PageB.html?AAA=aaa&BBB=bbb";
- // 在当前页面打开
- self.location = "PageB.html";
- // 在当前页面打开
- top.location = "PageB.html";
- // 打开新页面
- window.open("PageB.html?AAA=aaa&BBB=bbb");
- // ie?
- window.navigate("PageB.html");
- window.navigate("http://www.baidu.com");
- // 返回
- window.history.back( - 1);
- }
- /**
- * B页面
- */
- console.log(window.location.href);
- console.log(document.cookie);
- console.log(localStorage.CCC);
- console.log(localStorage.getItem("AAA"));
- console.log(sessionStorage.getItem("BBB"));
参考:
Window open() 方法
JS页面跳转大全
js页面跳转常用的几种方式
html 窗口管理
来源: http://www.bubuko.com/infodetail-2347227.html