Communicating Between Frames

After you have created a series of frames by using the <frameset> and <frame/> tags, how do you use JavaScript to access and manipulate each frame? As mentioned in the preceding section, each frame is a separate window object. Therefore, if you can reference each frame, you can use the same techniques that were used with windows for each frame.

The Document Object Model includes several properties that apply to frame and window objects that make referencing different frames much easier. These properties are self, window, parent, and top and their meanings are as follows:

  • self or window— These properties are used to refer to the current window or frame.

  • parent— This property is used to refer to the window or frame

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.