The top, parent, and opener meanings of the JS window object

Source: Internet
Author: User

    1. Top
      This change always refers to the top-level browser window of the split window. If you plan to execute commands from the top level of the split window, you can use the top variable.
    2. Opener
      Opener The object that is used to refer to the page that executes the window.open method on the window.open page. Example: a page through window.open () party
      Method pops up the B page, in the B page can be opener to refer to a page, so you can use this object to the a page operation.
    3. Parent
      The parent is used to access the object in the child page that is generated in iframe,frame. For example: A page has an IFRAME or frame, then the IFRAME
      or a page in a frame can refer to an object in page A through the parent object. This allows you to get or return a value to the a page.
      4. In addition, self refers to the current window
    4. Self
      Self refers to the current window

The difference between parent and opener:

Parent refers to the Father window, and in frameset, the parent of the frame is the frameset window.
Opener refers to the original window corresponding to a new window created with window.open.
The parent is an object that is relative to the frame.
Opener is the parent window for a window opened with window.open, provided the window.open is open.

Document.parentWindow.menthod () method that invokes the parent page.

Attached: Hierarchy Relationship of Window object, parent object, frame object, Document object, and Form object
The Window object →parent object →frame Object →document object →form object,
as follows: Parent.frame1.document.forms[0].elements[0].value;

The top, parent, and opener meanings of the JS window object

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.