Frames and Links

line.gif

Named Frames

When the tag <a> is used to link to another document, the document is loaded into the current frame - unless otherwise specified. However, frames can be assigned a name when declared within a frameset, as shown below.

<frameset cols="50%,*">
 <frame src=frameA.htm name=frameA>
 <frame src=frameB.htm name=frameB>
</frameset>

When a frame has been named in this way, the target attribute of the tag <a> may be used to specify a named frame as the destination frame into which the document is to be loaded. For example, a link contained in frameA.htm may load a document into frameB as follows.

<a href=document.htm target=frameB>

Named frames are ideal for navigation purposes.

Navigating with Frames

In the section on anchors, an example was presented demonstrating how a document may be structured to contain an entire book. It was said there that it is often hard to navigate within very large documents (even with anchors) and that it is better to structure a document into smaller (more easily navigated) panels. This section presents an example of how to use frames to format a book that is easily navigated. Prior to proceeding with the next exercise, please review exercise 8 and exercise 11.

Exercise 18

Take the following link to inspect a template for a book using frames. You should produce a book just like this and link it into the samples panel that you created in exercise 6. Take this link for a discussion of the solution to exercise 18. The next section next.gif discusses the predefined targets for links.