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.
This value is read/write in MSIE, but read-only in Netscape. Logically there is not much purpose in changing the name of an anchor anyway.
Beware that assigning a new name will affect the length of the document.anchors.
Changing the name in MSIE actually adds a new item to the document.anchors array that can be reached associatively with the new name. There will now be two entries for the same anchor and you can continue to access it using the old name as well.
If you are writing portable code and expect it to work in both MSIE and Netscape Navigator, this is the only property available in both browsers. Having located an anchor, being able to only access its name without any browser dependencies is rather limiting.
<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.name); </SCRIPT> </BODY> </HTML>