[网络收集]avascript中top.location.href 与 location.href的区别
2010-11-15 21:51
190 查看
top表示最顶级的窗口,也就是最外层的窗口。如果一个大窗口中嵌套了几个小窗口,那么在小窗口中使用top就表示最外面的大窗口,就是这个意思了。 top表示主窗口,location表示当前窗口,如果你的文件只有一个框架,没有iframe和frmaeset,那么是完全一致的,没有区别。 [code] javascript 中 if (window != top) top.location.href = location.href;
如果当前脚本所在网页是被别的网页框架显示的,那么框架网页的那个网页跳转到当前网页.比如: http:://www.diukai.com/1.htm <iframe src="http:://www.diukai.com/2.htm"></iframe> http:://www.diukai.com/2.htm <script>if (window != top) top.location.href = location.href;</script> 当访问 1.htm 地址会自动改变到 2.htm
[/code]
相关文章推荐
- window.location.Reload()和window.location.href 区别
- location和location.href跳转url的区别
- window.location.href页面跳转的用法(区别于redirect)
- window.opener.location.reload() and href()的区别
- 关于js中window.location.href,location.href,parent.location.href,top.location.href的用法与区别
- location.replace()和location.href=,location.reload()的区别 location.replace()和location.href=的区别
- 区别window.location.Reload()和window.location.href=window.location.href;
- javascript中window.open()与window.location.href的区别
- window.location.href和window.location.replace的区别
- JS 中document.URL 和 windows.location.href 的区别
- window.opener.location.reload() and href()的区别 弹出页修改后刷新父窗体 .
- JS 中document.URL 和 windows.location.href 的区别
- window.location.href和window.location.replace的区别
- window.location.href和window.top.location.href的区别
- window.location.href和window.location.replace的区别
- response.redirect 与location.href 的区别
- window.location.href和window.open的几种用法和区别
- window.location.Reload()和window.location.href 区别
- history.go()和location.Reload()和location.href 区别
- window.opener.location.reload() and href()的区别 弹出页修改后刷新父窗体