<a>


HTML DOM Anchor object


Anchor object

Anchor objects represent HTML hyperlinks.

An Anchor object is created each time the <a> tag appears in an HTML document.

Anchors can be used to create a link to another document (via the href attribute), or to create a bookmark within a document (via the name attribute).

You can access anchors by searching the anchors[] array in the Document object, or using document.getElementById().


Anchor Object Attributes

W3C: W3C standard.

AttributeDescriptionW3C
charsetSets or returns the character set of the linked resource.Yes
hrefSets or returns the URL of the linked resource.Yes
hreflangSets or returns the language code of the linked resource.Yes
nameSets or returns the name of a link.Yes
relSets or returns the relationship between the current document and the destination URL.Yes
revSets or returns the relationship between the destination URL and the current document.Yes
targetSetting or returning where to open the link.Yes
typeSets or returns the MIME type of the linked resource.Yes

Standard Properties and Events

Anchor objects also support standard properties and events .