[thelist] Using javascript in a map

Jeff jeff at members.evolt.org
Mon May 22 06:52:52 2000


matt,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Warden, Matt <mwarden@odyssey-design.com>
:
: > |   HREF="JavaScript://"
:
: Is that preferred over:
:
: ... href="javascript:void(-1);" onClick="doSomething();">
:
: ? The above is how I've always done it. I don't quite
: remember why I pass -1to void(). Seems there was
: a problem with browsers going to javascript:void() (it
: would show in the address bar and everything) if there
: was no passed argument. I forget why it's negative though.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

i think you're thinking void(0) as opposed to passing it a negative 1.  it
doesn't really matter though as it will take anything as an argument without
executing it.

you can use void() if you know for absolute certain that all your visitors
will be using a js1.1 capable browser.  however, if that's not certain, then
i would steer clear of it.  i personally don't like using it as it's just
that many more characters i have to type to make a url that doesn't link to
an actual document.

also, even if you're using void(), you should still be setting your onClick
event handler to return false.  that's just a good practice to get into.

good luck,

.jeff

name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff@members.evolt.org