please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 11
Windows and the JavaScript Name Space
Next
 

11.3 Windows and Frames

While Navigator (and other browsers) can display multiple HTML pages in multiple browser windows, it can also display multiple pages within a single window by using frames--a feature that allows a single browser window to be divided horizontally or vertically (or both) into individual sections that each display a separate HTML document. Although frames are not strictly windows in their own right, they behave like windows in many ways, and in JavaScript, each frame is represented with a Window object. Thus the Window class can represent both top-level browser windows and frames within a browser window (and frames within other frames, of course).

Each Window object has a frames[] array property that contains references to each of the frames (if any) that the window contains. The frames.length property specifies the number of frames in the array. Also, each Window object has a parent property that refers to the window or frame that contains the object (top-level browser windows have their parent property set to themselves). Thus, if a browser window contains two frames, and JavaScript code is running in the first frame, that code refers to the first frame implicitly or with the self or window properties. To refer to the second frame, that code could use the expression parent.frames[1].

The top property is similar to the parent property, but differs for frames that are recursively contained within other frames. The top property always contains a reference to the top-level browser window that contains the frame, which, in the recursive frames case, is not the same as the parent of the frame. Figure 11.1 illustrates the relationship between frames and windows, and shows a schematic representation of the frames[] array, and the parent, top, window, and self properties.

Figure 11.1: Browser windows and frames

[Graphic: Figure 11-1]

Top-level windows and frames have a significantly different representation on the screen, so it would seem that they would have a different representation in JavaScript. As we've seen, however, they are both represented by the Window object, and have the same properties and methods. As it turns out, the practical differences between top-level windows and frames really are quite minor:


Previous Home Next
Multiple Windows and Explicit Window References Book Index Window and Frame Names

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/java/script/definitive/ch11_03.htm, 7KB, , updated: 2019/10/14 16:00, local time: 2024/4/28 02:48,
TOP NEW HELP FIND: 
18.220.137.164:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.massmind.org/techref/language/java/script/definitive/ch11_03.htm"> [Chapter 11] 11.3 Windows and Frames</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to www.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .