The previous two lessons focused on the window
object — a programmatic representation of the browser window. The browser window typically contains one web page, and thus only one window
object. The <frameset/>
element, however, allows web developers to divide a browser window into two or more smaller window panes.
Each of these panes is itself a browser window, and as such has a full-fledged window
object. In fact, some browsers allow you to move and resize an individual frame with the moving and resizing methods you learned in Lesson 11 (it is highly recommended that you do not use these methods on a frame).
Arguably the most important aspect of dealing with frames as a JavaScript developer is accessing code and objects across frames. Over the course of this lesson you'll see many similarities between cross-frame scripting and cross-window scripting.
The easiest way to delve into frame scripting is with a demonstration. The first item you'll look at is the frameset page. Its HTML is as follows:
<html> <head> <title>Frameset Page</title> </head> <frameset rows="50%,*"> <frame name="frmTop" src="frame_top.htm" /> <frame name="frmBottom" src="frame_bottom.htm" /> </frameset> </html>
This is a simple frameset page: It divides the page into upper and lower regions. The frame on top, named frmTop
, loads the frame_top.htm
page into it, and the bottom frame, frmBottom
, loads frame_bottom.htm
. Make note of each frame's name, as they are ...
No credit card required