<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.
Attribute | Description | W3C |
---|---|---|
charset | Sets or returns the character set of the linked resource. | Yes |
href | Sets or returns the URL of the linked resource. | Yes |
hreflang | Sets or returns the language code of the linked resource. | Yes |
name | Sets or returns the name of a link. | Yes |
rel | Sets or returns the relationship between the current document and the destination URL. | Yes |
rev | Sets or returns the relationship between the destination URL and the current document. | Yes |
target | Setting or returning where to open the link. | Yes |
type | Sets or returns the MIME type of the linked resource. | Yes |
Standard Properties and Events
Anchor objects also support standard properties and events .