The Web Design Group presents:


Guide to frames usage



Using frames: Targeting other frames

Once you have set up a frameset, the next task is to determine which links should update which frames. Typically there is some distinction between the frames; for example, one is a table of contents, and the other presents documents chosen from there. Or, one presents a question and the other gives the correct answer.

Consider a simple example frameset with two equally-sized rows. Normally, links in a document in a frame update the contents of that frame. To have a link update another frame, use the TARGET attribute. The value of this attribute should be the name of the frame that should be updated. In the simple example given in the index, a link in frame "foo" that should update frame "bar" could be written as

<A HREF="other-document.html" TARGET=bar>this other document</A> 

Targeting multiple frames at once

It is not possible directly to update multiple frames at once. This is why I stress that the purpose of all frames should be determined at the very beginning. Multiple frames can only be updated at once if they are in the same row or column of a "super" frameset. For example, in the following frameset only one frame can be updated at a time.

Take a frameset with two columns, where the rightmost column has
two (25%/75%) rows, defined like this:

<FRAMESET COLS="*,*">
<FRAME SRC="leftmost.html" NAME=left>
<FRAMESET ROWS="25%,75%">
<FRAME SRC="top.html" NAME=topright>
<FRAME SRC="bottom.html" NAME=bottomright>
</FRAMESET>
</FRAMESET>

Because there is no way to address the rightmost column (the one containing the two rows), the two frames in there cannot be updated. Had this frameset been written as

<FRAMESET COLS="*,*">
<FRAME SRC="leftmost.html" NAME=left>
<FRAME SRC="rightmost.html" NAME=right>
</FRAMESET>

where the file "rightmost.html" contained a frameset definition such as

<FRAMESET ROWS="25%,75%">
<FRAME SRC="top.html" NAME=topright>
<FRAME SRC="bottom.html" NAME=bottomright>
</FRAMESET>

then the entire right half of the window could have been updated at once with just TARGET=right.

Using the special target values

As explained in the TARGET syntax definition, there are four special values.

The "_top" value

If this value is used, following the link will remove all currently existing framesets. This is useful for when the linked document has its own frameset, or it is an outside link. It's considered bad manners to "frame" someone else's site like this. And if the linked document has a frameset itself, the resulting nesting could be less than pleasant.

The "_parent" value

When using the second way described above to use nested framesets, updating the "right" frame can also be done by a link in one of the two documents in the innermost frames, if it uses "_parent" as value for TARGET.

The "_self" value

This value is only useful if this document contains a BASE element that specifies a default value for TARGET. This value overrides that; the link will update the frame that the document is in.

The "_blank" value

With this value, a new unnamed browser window is created. This may be useful in certain circumstances. If you want to be able to update the new window using frames and TARGET, you should instead use a new, unique name.

See also


Web Design Group
Last modified: 31 May 1997.
Feedback: galactus@htmlhelp.com
Copyright © 1996 - 2006. Arnoud "Galactus" Engelfriet. All rights reserved.