window,window.top和window.parent有什么区别? [英] What is the difference between window, window.top and window.parent?

查看:828
本文介绍了window,window.top和window.parent有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只注意到顶部窗口父母变量给我相同的价值。我正在测试这在Gmail收件箱页面。是否有人知道这三个值之间有什么区别?

解决方案

如果你在一个框架内:




  • window 引用当前帧。
  • parent 引用当前帧的父级。
  • top 引用最外框。


    如果你不在任何框架内,这些都将只是一个对当前窗口的引用。如果你只在一个框架内, parent top 都将是对同一事物的引用。

    I just noticed that top, window and parent variables are giving me the same value. I was testing this at gmail inbox page. Does anybody know what is the difference between these three values?

    解决方案

    If you are within a frame:

    • window refers to the current frame.
    • parent refers to the parent of the current frame.
    • top refers to the outermost frame.

    If you're not within any frame, these will all just be a reference to the current window. If you're only within one level of frame, parent and top will both be a reference to the same thing.

    这篇关于window,window.top和window.parent有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆