Language References
Sets or retrieves the destination of a hypertext link.
Inline |
<element HREF = strUrl...> |
Script |
object.href = strUrl ] |
strUrl |
String specifying the URL. |
The property is read/write with no default value.
The href property on an anchor [ A ] or AREA element can refer to:
- any valid URI
- any valid anchor point or bookmark within a document, specified with either:
- an anchor name attribute
- or any object’s id attribute.
When specifying an anchor, everything contained between the <a href ...> and the </a> tags defines the hyperlink to that address.
Following are several examples of how to set an anchor [ A ] element’s href attribute.
Linking to an absolute path:
<a href="http://www.abakada.com">Web WorkShop.</a>
Linking to a location within a document:
<a href="chapter1.html#intro">Overview</a>
The following shows how to set a hyperlink for an IMG element.
<a href="index.html"><img src="home.gif"></a>
The following shows how to set a hyperlink for an AREA element.
<area shape="rect" coords="0,0,76,122"
href="imgs/sun.gif" alt="Sun">
A, AREA, LINK
How HyperText Links Work