JavaScript » String » anchor

Syntax:
object.anchor("name")

This method is used to create an HTML anchor.

Examples

Code:
myString = new String("Anchor")
document.write (myString.anchor("newAnchor"))
Explanation:

This code creates an HTML anchor called "newAnchor" and writes the contents of the "myString" String object to the document which can then be used as a target for a hyperlink. This has identical results to using the HTML code: <A NAME="newAnchor">Anchor</A>