OBJECT:
Anchor
String.anchor(nameAttribute)
An Anchor object is a place in a document that is the target
of a hypertext link. There are two ways of creating it: by calling the
String.anchor method or by using the HTML 'A' tag. Each of these
tags that have a NAME attribute is placed by the JavaScript engine in
an array in the document.anchors property. An Anchor object
can then be accessed by indexing this array. The former uses code to
produce the anchor using the anchor method along with the document.write
or document.writeln method.
The following example creates an anchor called 'book_anchor' on the
string 'INDEX OF BOOKS'
Code:
var mystring = "INDEX OF BOOKS"
document.write(mystring.anchor("book_anchor"))
Using the HTML 'A' tag, you can do exactly the same as the above as
follows:
Code:
<A NAME="book_anchor">INDEX OF BOOKS</A>
The Anchor object inherits the watch
and unwatch methods from
Object, neither of which is supported by Microsoft JScript.
NOTE:
If the Anchor object is also a Link object, it'll have
entries in both the anchors and links arrays.
|