Linking
to frames In the document top.htm the
<FRAME SRC = "logo.htm"> tag loads the document logo.htm into the first
frame on the page and the tag <FRAME SRC = "bottom.htm"> loads the
document bottom.htm into the second frame. In the file bottom.htm the file pgindex.htm and
pgdata.htm are then loaded into the left and right frames respectively.
If you only create top.htm and bottom.htm and then load the
file top.htm into your browser using File, Open you will encounter errors when the files
logo.htm, pgindex.htm and pgdata.htm are not found. Create the files if you wish and
eliminate these errors -- the source for each is in HTML Source Box 2.
So far, so good. The problems will begin when you want to
load another document into one of the frames. If you include the usual <A HREF> tag,
the document will be loaded in the current frame which may not be the one you want it
loaded into. However, there are a number of options controlled by the value of the TARGET
attribute in the <A HREF> tag which allow you to specify which frame to load your
document into:
TARGET = _top: Replaces the whole window with the new page
thus eliminating the frames you have created.
TARGET = _self: Places the document in the current frame.
This is the default setting if the TARGET attribute is omitted.
TARGET = _parent: Replaces the document that set up the
current frame (its parent frame) with the new document. In our example this would replace
top.htm or bottom.htm depending on which frame was current.
TARGET = _blank: Opens a new copy of the browser to display
the page.
TARGET = framename: Opens the document in the named frame.
You name frames using the NAME attribute in the <FRAME>...</FRAME> tag.
Where you are using frames to create an indexed site such as
our example, you'll find that the TARGET = framename is the most commonly used attribute
value. To test this, create the documents from HTML Source Box 2 which give you two levels
of index and a few simple sample documents using some of these options. Place all the
documents in the one directory and load the document top.htm into your Web browser using
File, Open.
To see how the TARGET attribute works, select No Frames from
the page and notice how the TARGET = _top attribute works to open a document in place of
the top-most document, effectively removing the frames altogether. Select Frames from this
document to return to the frames version. Now test the More option to see how the second
index replaces the first in the current frame when no TARGET attribute is used. Finally
select Page 2 to see how, when a framename is used with the TARGET attribute, we can
specify a frame for display of the document. The second column is named "data"
in the document bottom.htm with the NAME = "data" attribute in the <FRAME>
tag.

|