There is one anchor object for every<A> HTML tag in the page.
Prior to version 1.2 of JavaScript, this array simply contained a list of anchors but there were no anchor objects accessible until Netscape 4 implemented them. The only property that could be accessed prior to that was the length of the array.
Changing the name of an anchor in MSIE leaves the existing anchor available and adds a copy using the new name. This may be important if you are parsing the anchors array with an enumerator.
Refer to the description of the AnchorArray object for details of how it enhances the built-in Array class.
There is some difference between the browsers in the way they implementanchor and linkobjects. In MSIE the anchor and link objects are represented identically and the objects simply ignore properties they don't need. Netscape supports different objects according to whether they are links or anchors.
DOM level 1 requires that this collection contains only those objects instantiated by an <A> HTML tag which contain a NAME="..." HTML tag attribute. Any anchors that have an ID="..." HTML tag attribute but no NAME="..." attribute should not be included.
Be aware that if you are not using some NAME or ID binding to the <A> tags, you may get unexpected results if new links are added and you are accessing elements of this array using numeric index values.
The DOM standard mandates at level 1 that only the A tags that have a NAME="..." HTML tag attribute should be included in this collection. Anchors with an ID="..." HTML tag attribute but no NAME="..." attribute should not be included in the collection.
Prev | Home | Next |
Document.all[] | Up | Document.applets[] |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |