The difference and use of window.parent and Window.opener

Source: Internet
Author: User

Window.parent is an IFRAME page called parent Page object

Example: a.html

If we need to assign a value to the Username text box in the a.html (like many upload functions, the Upload function page in the Ifrmae, upload the b.html after uploading the path into the text box of the parent page), We should write in the b.html:
var _parentwin = Window.parent;_parentwin.form1.username.value = "xxxx";

Window.opener is the parent page object called by window.open open child page

Opener: a reference to the Window object that opens the current window whose value is null if the current window is opened by the user.

Self represents its own window, and opener represents the window that opens itself, such as the Window a.html open window b.html. If you rely on the Window.Open method, the window b.html,self represents b.html itself, and the opener represents the window a.html.

The difference and use of window.parent and Window.opener

Related Article

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.