JS's parent, opener, self object

Source: Internet
Author: User

Transfer from http://blog.csdn.net/minsenwu/article/details/7455135

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.

Parent:This variable refers to the contains the parent window of the current split window。 If there is a split window within a window, and a split window is included in one of the split Windows, the 2nd split window can refer to the parent partition window that contains it. Opener:Means the original window corresponding to the new window created by window.open, etc.。 Report: hierarchy Relationship of Window object, parent object, frame object, Document object, and Form object: Windwo Object →parent Object →frame object →document object →form Object, as follows: Parent.frame1.document.forms[0].elements[0].value; Questions:Embed the frame <iframe&gt in a page, and then use the Jvascript script in the framework: parent.xx.value= ' xxxxx '; You can see the assignment in IE normally, but in Firefox it is not possible to complete the assignment. Which object should I call the parent frame in Firefox, and is it compatible with IE? Answer:Window.parent.document.form name. xx.value= ' xxxxx '; window can be omitted.   Parent.document.form name. xx.value= ' xxxxx '; Parent.document.getElementById ("xx"). value= ' xxxxx '; the difference between window.parent and Window.opener JavaScript calls the main window method 1:window.parent is an IFRAME page called parent Page objectExample: a.html to assign a value to the username text box in a.htm in B.htm(Like many upload function, upload function page in Ifrmae, upload the path after the upload to the parent page in the text box), we should write in the b.html:<script type= "Text/javascript" >var _parentwin = window.parent; _parentwin.form1.username.value = "xxxx"; </ Script> 2: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 :The self-referencing property, which is the application to the current Window object, is synonymous with the Window property. self represents its own window, and opener represents the window that opens itself., such as window a opens window B. If you rely on the Window.Open method, the window b,self represents B itself, and opener represents window A.

JS's parent, opener, self 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.