[thelist] href=# versus href=JavaScript.....

Tijs Teulings tijs.teulings at framfab.nl
Mon Mar 12 04:37:49 CST 2001


-----Original Message-----
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

usually the cases where the browser will puke on javascript: is where the
browser hasn't been instructed how to handle the link properly.  in most
cases where javascript:somefunction() is used as the value of the href
attribute it would be more appropriate to move the function call to the
onClick event handler and return false there as well to cancel the default
action of executing the value of the href attribute.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

isn't the 'official style' moving the reference to an onclick and
referencing to the void() function, like so;

<A HREF="javascript:void(0)">Click here to do nothing</A>

greets,
Tijs





More information about the thelist mailing list