HTML DOM Anchor object
Anchor Object
The Anchor object represents an HTML hyperlink.
In an HTML document, an Anchor object is created each time the tag appears.
Anchors can be used to create links to another document (via the href attribute), or to create bookmarks within a document (via the name attribute).
You can access an anchor by searching the anchors[] array in the Document object, or by using document.getElementById().
Anchor object properties
W3C: W3C standard.
| property | 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 target URL. | Yes |
| rev | Sets or returns the relationship between the target URL and the current document. | Yes |
| target | Sets or returns where to open the link. | Yes |
| type | Sets or returns the MIME type of the linked resource. | Yes |
Standard properties and events
The Anchor object also supports standardproperty and Events.