In the Weekly Newsletter for July 28, 2003 the following was advice was given.
Sometimes a person needs a link that does nothing when clicked.
For example, image rollovers require a link in order to change
the image. Suppose you only want to change the image when the
mouse moves over the link but don't want a click on the link
to send the browser to another page.
Here is what to do.
(1)
In the HEAD section of your web page, put:
<script type="text/javascript" language="JavaScript">
<!--
function nothing(){}
// -->
</script>
(2)
In your "do nothing" links you use the attribute:
The only diffrence between Armadillo's code and mine is the way in which the link will react. Using "#" will cause the page to "jump" back to the top. The method I described will keep the page from "jumping"
There are always so many ways to do the same thing when it comes to codeing a page. It is one of the things I find intrigueing about the whole process. :D
I like wildjokerdesign method better, because it's shorter, but in defence of this other way you can also do:
The other advantage with wildjokerdesign method is that it doesn't matter if the browser uses javascript. I think it's becoming less and less a concern, but I suppose better safe than sorry. :-)