Name
HTMLAnchorElement — a hyperlink or anchor in an HTML document
Availability
DOM Level 1 HTML
Inherits from/Overrides
Node → Element → HTMLElement → HTMLAnchorElement
Properties
This interface defines the properties in the following table, which
correspond to the HTML attributes of the
<a>
tag.
|
Property |
Attribute |
Description |
|---|---|---|
|
|
|
Keyboard shortcut |
|
|
|
Encoding of the destination document |
|
|
|
Used inside |
|
|
|
URL of the hyperlink |
|
|
|
Language of the linked document |
|
|
|
Name of the anchor |
|
|
|
Link type |
|
|
|
Reverse link type |
|
|
|
Used inside |
|
|
|
Link’s position in tabbing order |
|
|
|
Name of the frame or window in which the destination document is to be displayed |
|
|
|
Content type of the destination document |
Methods
-
blur( ) Takes keyboard focus away from the link.
-
focus( ) Scrolls the document so the anchor or link is visible and gives keyboard focus to the link.
Description
This interface represents an <a> tag in an
HTML document. href, name, and
target are the key properties, representing the
most commonly used attributes of the tag.
HTMLAnchorElement objects can be obtained from the
links and anchors
HTMLCollection properties of the HTMLDocument interface.
Example
// Get ...