

JAVA SCRIPT
More
about window and frame
|
We've seen a couple of instances of built-in variables being used in
the last few examples. One of the built-in variables is window.
The window variable refers to whatever window the JavaScript is
executing in. If you have some JavaScript in a frame and you write window.document.writeln(),
the writeln will happen in that frame. People sometimes use the
built-in variable called self instead of window. The two
(window and self) are interchangeable.
In the last example, you were introduced to the built-in variable
called top. This will always refer to the top-most browser
window. If you want to start at the top of the window hierarchy, use top.
Another built-in variable is parent, which refers to the
window containing the frame you're currently in. If you have a frameset in
a window, and one frame contains another frameset, the second frameset can
refer to the enclosing frame using the parent variable. This gets
a little tricky so I'm not going to go into it, but here's an example of
using JavaScript with frames inside frames for you to look over.
|