spacer
Yehuda Shiran November 7, 1999
Window References
Tips: November 1999

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
HP to Microsoft: Thanks for Nothing
iPhone Remains Left Out as Android Scores Flash
The Year of Living the OpenSocial
When working with frames, you must be familiar with the JavaScript connection between the frames. Each frame is represented by its own window object. The window object of a child frame is actually a property of the parent's window object.

The self property retrieves a reference to the current window or frame. The parent property retrieves the parent of the window in the object hierarchy. Finally, the top property retrieves the topmost ancestor window, which is its own parent. In other words, if self is equal to self.parent, then the current window doesn't have a parent, meaning it is the topmost window. In this case, self is also equal to self.top. The following diagram illustrates the usage of these window references:

The window Hierarchy

Note that recursive references are possible. For example, window.window.window evaluates to window, which is also equivalent to self.self.self.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script · Book Review: Content Rich
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Gateway Launches New Core i7-powered FX-Series Gaming PCs · Review: Lenovo ThinkPad SL300 · EBay, Alternative Site Holiday Resources for Sellers