In this discussion I will show how to create HTML code that divides a single browser window into three regions, called frames, to display the three documents simultaneously, as shown in Fig. 2.
Later, I will show how hyperlinks in one frame can be configured to update contents in other frames. In an example given in a later presentation, we will program the hyperlinks YZ and ZY in each frame so that document viewers can switch the positions of documents Y and Z by selecting hyperlinks in any of the frames.
If Netscape Communications' proposed frame syntax is widely accepted -- and it most likely will be -- then the filename extension ".html" will come to signify not only one, but two kinds of documents: layout documents and contents documents.
upper frame | |
lower left frame |
lower right frame |
To accomplish this we will first divide the browser window into upper and lower frames, and then further divide the lower frame into lower-left and lower-right frames. The first of these two divisions is specified in layout document a.html, given in Fig. 4.
|
As you can see, this is a new kind of HTML. Several things are worth observing in this code.
<body>
tags that usually
appear in HTML documents have been replaced by
<frameset>
tags. This is the distinguishing feature
of layout documents.
<frame>
is a
single entity and does not occur with a closing </frame> counterpart.
<frameset>
Tag<frameset>
tags replace
<body>
tags in layout documents. The opening
<frameset>
tag must include either a row list or a
column list, taking the form
"rows=
row_list" or
"cols=
column_list" immediately after the keyword
frameset
, as seen in a.html. Row or column lists
are comma separated lists of frame size specifications. In
a.html, we have chosen to allow browser software to determine row
frame heights by using the value *
for each row. (The width
of the row frames will, in this case, be determined by the width of the
browser window.) Each member in a row or column list represents only a
declaration of a frame's existence. Frame definitions,
which specify the actual contents of previous declared frames, are
indicated within the <frame>
tag.
<frame>
Tag<frameset>
tags to divide the
browser window into two row frames, we must now instruct the browser what
to put in these frames. We accomplish this through the
<frame>
tags, which occur between <frameset>
tags and define the contents of each frame declared in
the row or column list of the preceding frameset
tag.
In our example, because the row list ("rows=*,*
") specifies
the existence of two row frames, the code in a.html contains two
frame
specifications. Before continuing, please take a
moment and look at them again.
<frame>
tag by adding the
tag property "src=URL
", as seen in
a.html. At view time, after the browser has laid out the
document's frames, it will then use these URLs to load documents for
display within the frames.
name=
frame_name" in the <frame>
tag, as shown in the second frame definition in a.html. In this
example, the upper row has no name, while the lower row has the name
"bottom". Assigning names to frames makes it possible to
later target them for update when hyperlinks are selected.
<frame>
tag with a URL to
specify the frame's contents, as shown in a.html, it is also
acceptable to replace the <frame>
tag with an additional,
nested <frameset>
declaration. For example, the
<frameset>
specification in Fig. 5a would do quite nicely
for a framed document with the layout and contents shown in Fig. 5b, and
would effectively have the same appearance as Fig. 2.
|
|
||||
a | b |
<frameset>
tags.
The disadvantage of directly nested frames is that they require nested
<frameset>
tags, which make it difficult to assign names
to collections of frames, such as the row made up of y.html and
z.html in Fig. 5b. (Recall t hat frame names are specified
within <frame>
tags, not <frameset>
tags.)
To get around this limitation, we will use indirect frame nesting,
exploiting the fact that the second frame definition in a.html, a
layout document, contains a URL to yet another layout document,
yz.html!
|
If you've understood the discussion up to this point, then you should have no problem seeing that yz.html has the exact same structure as a.html, except that it specifies a layout divided into two columns, rather than rows. We've already seen in Fig. 1 what contents documents y.html and z.html look like when viewed separately. The code in yz.html allows us to view both of these documents side by side, in a column-frame separated window, as shown in Fig. 7.
Further, because layout document yz.html is the URL given for the second frame in a.html, we now have the layout shown in Fig. 5. The logical structure of the layout documents and contents documents involved here is illustrated in Fig. 8.
a.html (layout)
|
Fig. 2, already presented, shows how this document would appear on Netscape Navigator 2.0, a frames-capable browser. It is given again in Fig. 9.
If you've understood everything up to this point, you are now ready to learn frame targeting, the subject of my next presentation. However, if things are still kind-of cloudy, you should read this document one more time, carefully studying the figures an d sample code, before continuing.
![]() | Netscape Frames Main Menu |
![]() | Questions about frames |
![]() | previous lesson: |
![]() | next lesson: "Targeting Frames" |