[Index] [Up] [Back] [Next]

4.5.2 NAME attribute in an Anchor

As mentioned previously, anchors mark the beginning or end of hypertext links. The NAME attribute (which is optional) marks the anchor as a possible target of a link from another document, or from within the same document.

(With HTML+ the NAME attribute will be changed to ID)

Usage

Here is a typical example
<A NAME="poison"> Toadstools </A>
Where the identifier poison is used to NAME the anchored text as the possible target of a hypertext link. The reference identifier can be an arbitrary string, but it must be unique within the document.

Targeting NAMEd Anchors

Named anchors can be targeted, within the same document, using HREF - you simply HREF the name, prepending a `#':
<A HREF="#poison"> Poisonous non-mushrooms </A>

you can also target the NAMEd anchor from another document, simply by adding the NAME after the document filename. For example, if the identifier `poison' was located in the file `toads.html' it could be referenced by either

<A HREF="toads.html#poison"> Poisonous non-mushrooms </A>
or
<A HREF="http://www.site.edu/slimy/toads.html#poison"> Poisonous 
non-mushrooms </A>.

[Index] [Up] [Back] [Next]