Name

Link — a hypertext link

Availability

Client-side JavaScript 1.0; enhanced in JavaScript 1.1

Inherits From

HTMLElement

Synopsis

                     document.links[]
document.links.length

Properties

Link inherits properties from HTMLElement and also defines or overrides the following properties:

hash

The anchor specification of a link.

host

The hostname and port portions of a link.

hostname

The hostname portion of a link.

href

The complete URL of a link.

pathname

The path portion of a link.

port

The port portion of a link.

protocol

The protocol portion of a link.

search

The query portion of a link.

target

The target window of a hypertext link.

text

The text of a link. Navigator 4.

x

The X coordinate of a link. Navigator 4.

y

The Y coordinate of a link. Navigator 4.

Methods

Link inherits the methods of HTMLElement.

Event Handlers

Link inherits the event handlers of HTMLElement and defines special behavior for the following three:

onclick

The handler invoked when a link is clicked. JavaScript 1.0; enhanced in JavaScript 1.1.

onmouseout

The handler invoked when the mouse leaves a link. JavaScript 1.1.

onmouseover

The handler invoked when the mouse goes over a link.

Get Webmaster in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.