The most common use of frames is also what makes them the most useful, putting up a table of contents on the side or the top of the frame. But how do you get the frames to open in a different window when you click on them?
Naming Frames
When you are describing the frames in your frameset, one of the attributes is the frame name (as described in part 3). Once you have named a frame, it can become the destination for any link in any other frame. To accomplish this, you use the TARGET attribute in your anchor tag.
To return to the sample framed site, in part 1, we created
a frame.html page. In order to open links in the navigate.html page, I need to name
the frames in the frameset:
<html>
<head>
<title>A Sample Framed Page</title>
</head>
<frameset rows="50,*">
<frame src="/tmc/navigate.html" name="navigate">
<frame src="/tmc/body.html" name="contents">
<noframes>
This is a framed page, please go to <a
href="/tmc/body.html">the body page</a> for more
information.
</noframes>
</frameset>
</html>
Then, every link in the navigate.html page that I want to open in the
body.html frame would have a target of contents, for example:
<a href="http://webdesign.about.com/" target="contents">About</a>
Note: If you target a link to a frame name that doesn't exist, the browser will open a new window and give that window the specified name. After that, all anchors linked to that target will open in the new window.
Special Targets
There are four reserved target names that do special actions in the browser:_blankThis loads the linked document into a new browser window with no name._selfThis is the default action for all anchor tags. Any linked document with this target will load into the same window as the link. The only time this target is not redundant in when it's used in the base tag in a document head._parentThis target causes the linked document to be loaded into the parent window or frameset. If there is only one frameset, the document will be loaded into the browser window. If there are nested framesets, the document will be loaded into the next level frameset up._topThis target removes all framesets and loads the linked document into the top level window of the browser.
Note: All of these targets begin with the underscore (_) character. Do not use an underscore as the first character of a target name. The browser will ignore all targets starting with underscore other than the four named above.


