April 2, 2001 - Using a Dummy URL | WebReference

April 2, 2001 - Using a Dummy URL

Yehuda Shiran April 2, 2001
Using a Dummy URL
Tips: April 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Sometimes you want to prevent the browser from going to a URL that has been clicked. There are cases where all you want from the URL is to activate its side effects, such as an onClick() event handler. One way to avoid the URL from being activated is to write an empty JavaScript: command:

<A HREF="javascript://">This link is used only for its color</A>

The link renders as:

This link is used only for its color