HTML DOM AnchorObject


Anchor Object

The Anchor object represents an HTML hyperlink.

In an HTML document, an Anchor object is created each time an <a> tag appears.

An anchor can be used to create a link to another document (via the href attribute), or to create a bookmark inside a 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 link. Yes
type Sets or returns the MIME type of the linked resource. Yes

Standard Properties and Events

The Anchor object also supports the standardpropertiesandevents。

Other Extensions