开发者

What is the difference between window, window.top and window.parent?

开发者 https://www.devze.com 2023-01-11 22:15 出处:网络
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 开发者_如何学JAVAthese three

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 开发者_如何学JAVAthese 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消