window.top.location.href 和 window.location.href 的区别
2015-06-18 00:00
218 查看
"window.location.href"、"location.href"是本页面跳转.
"parent.location.href" 是上一层页面跳转.
"top.location.href" 是最外层的页面跳转.
举例说明:
如果A,B,C,D都是html,D是C的iframe,C是B的iframe,B是A的iframe,如果D中js这样写
"window.location.href"、"location.href":D页面跳转
"parent.location.href":C页面跳转
"top.location.href":A页面跳转
如果D页面中有form的话,
<form>: form提交后D页面跳转
<form target="_blank">: form提交后弹出新页面
<form target="_parent">: form提交后C页面跳转
<form target="_top"> : form提交后A页面跳转
如果访问的是iframe里面的页面,重新加载最外层的页面
"parent.location.href" 是上一层页面跳转.
"top.location.href" 是最外层的页面跳转.
举例说明:
如果A,B,C,D都是html,D是C的iframe,C是B的iframe,B是A的iframe,如果D中js这样写
"window.location.href"、"location.href":D页面跳转
"parent.location.href":C页面跳转
"top.location.href":A页面跳转
如果D页面中有form的话,
<form>: form提交后D页面跳转
<form target="_blank">: form提交后弹出新页面
<form target="_parent">: form提交后C页面跳转
<form target="_top"> : form提交后A页面跳转
如果访问的是iframe里面的页面,重新加载最外层的页面
<html> <head> <title></title> <script language="javascript"> function escapeFrame(){ if (window.top.location.href != window.location.href) { window.top.location.reload(); } } </script> </head> <body onload="escapeFrame()"> <iframe src="b.html" ></iframe> </body> </html>
相关文章推荐
- linux 的隔离级别 LXC
- Linux下PHP5.5编译参数详解
- Linux 驱动开发索引
- Linux 设备模型(中)之上层容器
- [分享黑科技]纯js突破localstorage存储上线,远程抓取图片,并转码base64保存本地,最终实现整个网站所有静态资源离线到用户手机效果却不依赖浏览器的缓存机制,单页应用最新黑科技
- Tutorial2 Hello dot!
- adb shell input 命令
- Linux 设备模型(中)之上层容器
- Linux 设备模型(上)之底层模型
- IIS配置MVC网站
- hadoop 伪分布式环境配置
- centos git
- 使用xshell出现乱码
- OpenCv下载地址
- 浅析Apache Storm 0.10.0-beta发布:剑指Heron
- 浅析Apache Storm 0.10.0-beta发布:剑指Heron
- 服务器阵列的IOPS测试
- Detect if two integers have opposite signs
- Linux_3.3_系统调用方式文件编程
- Apache Shiro 学习记录3