• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

14.8. Anchors

The anchors[] array of the Document object contains Anchor objects representing named locations in the HTML document that are marked with the <a> tag and its name attribute. The anchors[] array has existed since JavaScript 1.0, but the Anchor object is new in JavaScript 1.2. In previous versions, the elements of the anchors[] array were all undefined, and only the length property was useful.

The Anchor object is a simple one. The only standard property it defines is name, which is the value of the HTML name attribute. As with the Link object, the text that appears between the <a> and </a> tags of the anchor is specified by the text property in Netscape 4 and by the innerText property in Internet Explorer 4. Neither of these properties is supported by the W3C DOM standard, but we'll see other ways to obtain the text content of an element in Chapter 17.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint