Anchor.name (Property)

This corresponds to the NAME attribute of the <A> HTML tag.

Availability:

DOM level - 1
JavaScript - 1.2
JScript - 3.0
Internet Explorer - 4.0
Netscape - 4.0
Property/method value type:String primitive
JavaScript syntax:-myAnchor.name
-myAnchor.name = aName
HTML syntax:<A NAME="aName">
Argument list:aNameA new name for the anchor.

The value of this property is defined by the NAME tag attribute in the HTML that describes the document. Without the NAME attribute, the anchor object does not get added to the anchors[] array.

This name property contains a case sensitive value. It is case sensitive because it can be used as a value in one of the document hierarchies to locate an object.

The example should present the word "EXAMPLE" on all compliant browsers.

Warnings:

Example code:

   <HTML>
   <HEAD>
   </HEAD>
   <BODY>
   <A NAME="EXAMPLE" HREF="http://www.mydomain.com/folder/file.html#abcdef">Click here</A>
   <BR>
   <SCRIPT>
   document.write(document.anchors[0].name);
   </SCRIPT>
   </BODY>
   </HTML>

See also:Anchor object, AnchorArray.length, Document.anchors[], NAME="...", String.anchor(), Url.name