Review
of the target attribute
Previously you learned about the target attribute that
allows you to control where a link appears. By default a link will open
in the same frame containing the link. The following are common built-in
targets you can use. Also recall you can set your own default target
using the base tag in the head section, which you can override by specifying
a new target in the individual anchor tag.
- _self - opens link in the same frame (default)
- _blank - opens the link in a new window
- _top - opens the link at the top, replacing frames
- _parent - opens the link in the frame containing the current frameset.
Only differenct from _top whien you nest framesets.
Linking
from a menu frame to a content frame
In order to control which frame a link appears, your frames
must have a name that begins with an alphanumeric character (not the
underscore as in the built-in target). Designers commonly create a frameset
that contains a menu frame and a main or body frame, the following example
illustrates the coding of this type of targeting.
Click here to view example
In the frameset definition:
<frameset cols="150,*">
</frameset>
In the menu1.html page:
<a href="body1.html" target="body">Link to page 1</a>
<a href="body2.html" target="body">Link to page 2</a>
<a href="body3.html" target="body">Link to page 3</a>
Link
from a Menu Frame
Click here to download lesson
files
- Edit the navbar2.html file.
- Add anchor tags to link each button as follows.
- Link button1 to main.html target main.
- Link button2 to directions.html target main.
- Link button3 to specifics.html target main.
- Link button4 as a mailto link to your email address.
- Save your changes.
- View lab05g.html in the browser.
Linking
from a content frame to a parent frame
When using framesets, since users can optionally open
individual frames separately, it's always a good idea to include at
least a link in each content page back to the home page that reestablishes
the menu frame.
Click here to view example
<a href="frameseth.html" target="_top">Home</a>
Link
from a Menu Frame
- Edit the main.html, directions.html and specifics.html
files.
- Add anchor tags to include a link back to the
home page including the menu on each of the pages.
- Save your changes to each page.
- View lab05g.html in the browser.