Window.parent (Property)

A reference to the parent window in a framed pane.

Availability:

JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
Property/method value type:Window object
JavaScript syntax:-myWindow.parent
-parent

For top level windows, the parent property is the same as the self property.

For framed windows the parent will be a Window object.

In the same way that you can walk downwards through the frames hierarchy with a frames[ ... ].frames[ ... ] construct, a parent.parent construct will walk upwards through the hierarchy.

It is important to know where you are so that this is as useful as possible. Relative locations in trees need to have some awareness of the root. If you don't detect this, you might have problems.

Detecting whether you have reached the root can be accomplished by testing whether the parent property of a window refers to the same object as the window itself.

When you reach the top of the tree, the parent property should yield the same value as the self property. This means that the property will equivalent to self for all windows unless they are inside frames. In MSIE, this also means that they are possibly inside an <IFRAME> as well.

Inside a modal dialog window, the parent will be a Dialog object.

Warnings:

See also:Dialog object, Frame object, Window object, Window.frames[], Window.top

Property attributes:

ReadOnly.

insert figure 0072