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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

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.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

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

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business