opener property (window)
Sets or retrieves a reference to the window that opened the current document.
- If a document opens a page in a new browser window (for example, by an anchor element or the open method), then the opener property can be used in the child document to access the parent window object.
- If the current document is within a frame or iframe and you need the window that hosts the current window, use the parent property.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
Possible values:
Reference to the opener window.
Default: this property has no default value.
Example HTML code 1:
This example shows how to open a child window and communicate between the opener and the child window:
|
|||||
<head> <script type="text/javascript"> function OpenChildWindow () { window.open ("childWindow.htm", "OpenerTest", "width=300, height=200"); } </script> </head> <body> First open a child window with this button: <button id="childOpener" onclick="OpenChildWindow ();">Open child window!</button> <br /><br /> You can change the text color of the button with the selection list of the child window. </body> |
|||||
|
|||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments