Easy Tutorial
❮ Prop Style Backgroundrepeat Prop Screen Colordepth ❯

HTML DOM


Anchor Object

The Anchor object represents an HTML hyperlink.

Each occurrence of the <a> tag in an HTML document creates an Anchor object.

Anchors can be used to create links to another document (via the href attribute) or bookmarks within the document (via the name attribute).

You can access anchors 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 linked document. Yes
type Sets or returns the MIME type of the linked resource. Yes

Standard Attributes and Events

The Anchor object also supports standard attributes and events.

❮ Prop Style Backgroundrepeat Prop Screen Colordepth ❯