Details about window. parent, window. top, and window. self in Js

Source: Internet
Author: User
When the application has a frameset or iframe page, parent is the parent window, top is the top parent window (some windows have several layers of frameset or iframe), and self is the current window, opener uses the open Method to open the current window. Window. self function: it is for when... SyntaxHig

When the application has a frameset or iframe page, parent is the parent window, top is the top parent window (some windows have several layers of frameset or iframe), and self is the current window, opener uses the open Method to open the current window.

 

Window. self


Function: it refers to the reference of the current window. It is equivalent to the window attribute.

Syntax: window. self

Note: window, self, and window. self are equivalent.

 

Window. top

Function: Return to the top-level window, that is, the browser window.

Syntax: window. top

Note: If the window itself is a top-level window, the top attribute returns a reference to itself.

 

Window. parent

Function: return to the parent window.

Syntax: window. parent

Note: If the window itself is a top-level window, the parent attribute returns a reference to itself.

In the frame webpage, the parent window is usually the top-level window, but if there is a frame in the Framework, the parent window and the top-level window are not necessarily the same.

 

Determine whether the current window is in a framework:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.