Frames: HTML
Create Hyperlinks Between Frames

The Simple Frameset One of the advantages of frames is the ability to click on a hyperlink in one frame and change the document in another frame.
When you activate a hyperlink in a frame document, you need to specify not only what document to load but also where (i.e., in which frame) to put it.
Targets The frame where the new document is supposed to appear is called the target.
There are two types of targets
  • Explicit: the name assigned to a frame in the frameset.
  • Implicit: a name which describes the target frame’s relationship to  the frame containing the original hyperlink.
NOTE: the names assigned to the frames in the example are banner, toc, and main.
Implicit target names always begin with an underscore (_).

The two most common implicit names are:

  • _self: the default. Tells the browser to load the new document in the frame where the hyperlink appears.
  • _top: tells the browser to open the link in a new window without frames.

The _top target name is most often used when you are linking to an external web site whose window may not fit in your frame.

Take another look at our frameset example:

banner

toc main
Note that I have identified each frame by the name I gave it when I created the frameset in HTML: Create a Simple Frameset
I can also identify the frames by the names of the web page files I have inserted in each frame:

banner.htm

toc.htm default.htm
To create a hyperlink from one frame in a frameset to another frame in the same frameset, use the TARGET attribute with the anchor command.
For example, if I wanted to create a hyperlink in the toc frame that would change the document in the main frame from default.htm to pagetwo.htm I would use the following HTML code:
<A HREF="pagetwo" TARGET="main">Page Two</A>

banner.htm

Page Two default.htm
When the visitor clicks on the hyperlink on Page Two in the left hand column, the contents of the right hand column change to the file pagetwo.htm. NOTE: The Page Two hyperlink above is for illustration purposes only.  It does not work.

Frames: HTML
Overview
Create a Simple Frameset
Create Hyperlinks Between Frames

 

Personal Home PageWeb Design CenterTutorial MenuTop of Page

Web Design Center
Last Revised: October 19, 2006
© Agatha Taormina