js中的window.与window.parent及window.top.

来源:互联网 发布:程序员一年能赚多少钱 编辑:程序博客网 时间:2024/06/11 22:39

参考:http://xiaolele.iteye.com/blog/525996

1、window.、window.parent.、window.top.三者区别

"window.location.href"和"location.href"指的是本页的跳转。

"window.parent.location.href"指的是本页上并紧挨着本页的浮动框架页等的跳转。

"window.top.location.href"指的是叠在最上层的框架页等的跳转。


例如:

有A,B,C,D四个页面,D是C的frame,C是B的frame,B是A的frame。

在D页面中写,"window.location.href"、"location.href"指的是D页面本身的跳转。

在D页面中写,"window.parent.location.href"指的是C的页面跳转。

在D页面中写,"window.top.location.href"指的是A的页面跳转。


2、关于页面刷新,在D 页面中写:"window.parent.location.reload();"可以使 C页面刷新




0 0
原创粉丝点击