Node
This interface defines the properties in the following table, which correspond to the HTML attributes of the <a> tag.
Property |
Attribute |
Description |
---|---|---|
String accessKey |
accesskey |
Keyboard shortcut |
String charset |
charset |
Encoding of the destination document |
String coords |
coords |
Used inside <map> elements |
String href |
href |
URL of the hyperlink |
String hreflang |
hreflang |
Language of the linked document |
String name |
name |
Name of the anchor |
String rel |
rel |
Link type |
String rev |
rev |
Reverse link type |
String shape |
shape |
Used inside <map> elements |
long tabIndex |
tabindex |
Link's position in tabbing order |
String target |
target |
Name of the frame or window in which the destination document is to be displayed |
String type |
type |
Content type of the destination document |
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.
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.
// Get the destination URL of first the hyperlink in the document var url = document.links[0].href; // Scroll the document so the anchor named "_bottom_" is visible document.anchors['_bottom_'].focus( );
Link and Anchor objects in the client-side reference section