Skip to Main Content
JavaScript: The Definitive Guide, Fourth Edition
book

JavaScript: The Definitive Guide, Fourth Edition

by David Flanagan
November 2001
Intermediate to advanced content levelIntermediate to advanced
936 pages
68h 43m
English
O'Reilly Media, Inc.
Content preview from JavaScript: The Definitive Guide, Fourth Edition

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

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

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

JavaScript: A Beginner's Guide, Fourth Edition, 4th Edition

JavaScript: A Beginner's Guide, Fourth Edition, 4th Edition

John Pollock
Coding with JavaScript For Dummies

Coding with JavaScript For Dummies

Chris Minnick, Eva Holland

Publisher Resources

ISBN: 0596000480Supplemental ContentCatalog PageErrata