Site hosted by Angelfire.com: Build your free website today!
By: Shehzeen Hingoro         

 HomeE-Business | Main Page | My Profile 

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.

  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.

<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  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.

 HomeE-Business | Main Page | My Profile 

Copyright 2003. All rights reserved.