The following piece of code is about window.parent and window.opener difference in terms of the, if we use the value to the iframe to another frame is necessary to use window.opener.document.getElementById (name). Value = uvalue; this Oh forms.
window.parent can get a frame of the parent window or parent frame. Top-level reference to the parent window itself.
This feature can be used to determine whether this window is the top-level window. Such as:
function IsTopWindow (win)
if (win.parent == win) return true;
else return false;
window.opener refers to the window.open to open the pages of the parent page.
opener that is, who opened to me, such as A page B page using pop-up window, window.open, then the page where the window A is B page opener, the B page can be accessed through the opener object A page.
parent that the parent window, such as a page using iframe or frame A calls B page, then A page B page where the window is the parent.
In the JS in, window.opener just pop a reference to the parent window. For example:
a.html in other ways by clicking the button a new window window.open b.html. Then b.html, it is possible through the window.opener (omitting to write for the opener) to refer to a.html, include the document a.html and other objects, the operation a.html content. If the reference fails, then return null. Therefore, the object before calling the opener, we must first determine whether the object is null, it will lead to "object is empty or does not exist" JS error.
window.opener returns the current window to create a reference to the window, such as clicking on a link and a.htm open b.htm, and we intend to enter a value in the b.htm a.htm then given on an id for the "name" in the textbox, then you can write to:
window.opener.document.getElementById ("name"). value = "input data";