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> 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