This article mainly introduces the Differences Between opener and parent in js. If you need them, you can refer to them and hope to help you, for example, A page uses window. when the open dialog box appears, the window where page A is located is the opener of page B. You can access page A through the opener object on page B.
Parent indicates the parent window. For example, if A page A uses iframe or frame to call page B, the window where page A is located is the parent of page B. In JS, window. opener only references the parent window of the pop-up window. For example, in a.html, open a new window B .html by clicking the "click" and click "other" to generate a new window. Contents.
If this reference fails, null is returned. Therefore, before calling an opener object, you must first determine whether the object is null. Otherwise, a JS error "the object is empty or does not exist" will occur.
Example:
Aa.html
The Code is as follows:
Untitled document
Bb.html
The Code is as follows:
Untitled document
In a textbox with the id "name" on window. opener worker, you can
Written:
Optional values opener.doc ument. getElementById ("name"). value = "input data ";
Extends extends opener.doc ument. getElementById ("name"). innerHTML = "input data ";