Name

HREF — NN all IE all HTML all

Synopsis

HREF=”URI"

Required for links

The URI of the destination of a link. In browsers, when the URI is an HTML document, the document is loaded into the current (default) or other window target (as defined by the TARGET attribute). For some other file types, the browser may load the destination content into a plugin or save the destination file on the client machine. In the absence of the HREF attribute, the element does not distinguish itself in a browser as a clickable link and may instead be only an anchor (if the NAME or ID attribute is set).

Example

<A HREF="part1/chap3.html">Chapter 3</A>

Value

Any valid URI, including complete and relative URLs, anchors on the same page (anchor names prefaced with the # symbol), and the javascript: pseudo-URL in scriptable browsers to trigger a script statement rather than navigate to a destination.

Default

None.

Object Model Reference

IE

[window.]document.links[i].href

[window.]document.all.elementID.href

NN

[window.]document.links[i].href

In both browsers, other link object properties allow for the extraction of components of the URL, such as protocol and hostname. See the Link object in Chapter 9.

Get Dynamic HTML: The Definitive Reference 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.