asp.net.ph

Skip Navigation Links

HREF Attribute | href Property

Language References


Sets or retrieves the destination of a hypertext link.

Syntax


Inline <element HREF = strUrl...>
Script object.href = strUrl ]

Possible Values


strUrl String specifying the URL.

The property is read/write with no default value.

Remarks

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.

Example

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">
Applies To

A, AREA, LINK

See Also

How HyperText Links Work



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note