Creates an HTML anchor that is used as a hypertext target.
|Method of String|
- A string.
anchor method with the
document.writeln methods to programmatically create and display an anchor in a document. Create the anchor with the
anchor method, and then call
write function to display the anchor.
In the syntax, the text string represents the literal text that you want the user to see. The
nameAttribute string represents the
NAME attribute of the A tag.
Anchors created with the
anchor method become elements in the
The following example code within an HTML
var myString = "Table of Contents"; document.writeln(myString.anchor("contents_anchor"));
will output the following HTML:
<A NAME="contents_anchor">Table of Contents</A>