Latest web development tutorials

HTML DOM Anchor objects

Anchor objects

Anchor object represents an HTML hyperlink.

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

Link anchor can be used to create a link to another document (with the href attribute), or create a bookmark (by the name attribute) within the document.

You can search for Document object anchors [] array to access the anchor, or use document.getElementById ().


Anchor Object Properties

W3C: W3C standards.

属性 描述 W3C
charset 设置或返回被链接资源的字符集。 Yes
href 设置或返回被链接资源的 URL。 Yes
hreflang 设置或返回被链接资源的语言代码。 Yes
name 设置或返回一个链接的名称。 Yes
rel 设置或返回当前文档与目标 URL 之间的关系。 Yes
rev 设置或返回目标 URL 与之间当前文档的关系。 Yes
target 设置或返回在何处打开链接。 Yes
type 设置或返回被链接资源的 MIME 类型。 Yes

Standard properties and events

Anchor objects also supports standard attributes and events .