Writing to Other Frames and Windows
You can also use the document.write()
method to
send dynamically created content to another frame in a frameset or to
another browser window. In this case, you are not restricted to only
one call to document.write()
per page; you can
open an output stream to another frame or window and keep dumping
stuff into it until you close the output stream with
document.close()
.
All you need for this kind of content creation is a valid reference to the other frame or window. How you generate the frameset or secondary window influences this reference.
Framesets and Frames
A typical frameset document defines the physical layout of how the main browser window is to be subdivided into separate panels. Framesets can, of course, be nested many levels deep, where one frame loads a document that is, itself, a frameset document. The key to writing a valid reference to a distant frame is knowing the relationship between the frame that contains the script doing the writing and the target frame.
The most common frameset structure consists of one frameset document
and two to four frames defined as part of that frameset (you can have
more frames if you like, but not everyone is fond of frames).
Ideally, you should assign a unique identifier to the
NAME
attribute of each
<FRAME>
tag. Example 5.3 is a basic frameset document that assigns a name to each of the three frames and loads an efficient local blank page into each frame. The technique used here is to invoke a function, ...
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.