Top, parent, and opener Meanings of JS window objects _javascript Tips

Source: Internet
Author: User

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

The difference between parent and opener:

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

Document.parentWindow.menthod () method to adjust the parent page

Class relationships for Window objects, parent objects, frame objects, document objects, and form objects
Window object →parent Object →frame Object →document object →form object,
as follows: Parent.frame1.document.forms[0].elements[0].value;

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.