parent property (window)
Returns a reference to the immediate parent window object in the window hierarchy.
- The parent property is useful if the current document is placed within a frame or iframe element and you need to access the host window.
- If the current document is placed within a subframe (a frame within a frame) and you need to access the topmost ancestor window, use the top property.
- To get the host frame or iframe element instead of the parent window, use the frameElement property.
- If you need to walk downwards in the frame window hierarchy, use the contentWindow property. It returns the window object that belongs to a frame or iframe element.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read-only.
Possible values:
If the current document is in a frame or iframe element the value refers to the parent window, otherwise it refers to the current window.
Default: this property has no default value.
Example HTML code 1:
The contents of the file in which the iframe element is placed:
|
|||||
<body> The base site <iframe src="window_parent.htm"></iframe> </body> |
|||||
|
|||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments