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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint