[Javascript] href vs onclick

Peter-Paul Koch gassinaumasis at hotmail.com
Tue Oct 8 05:29:41 CDT 2002



>I always used to call my scripts like this:
><a href="#" onclick="myFunction();">click here</a>
>
>but have recently found this is causing problems with IE5

5.0 (as opposed to 5.5)?

>the workaround has been to do this:
><a href="javascript:myFunction();">click here</a>
>
>is this the correct way to call scripts or are both methods acceptable?
>
>just wondering if I've been doing things wrong all this time,

There's a bug in IE 5.0 that requires you to use <a href="javascript:etc"> 
when submitting a form through JavaScript. The onClick simply won't work. 
But I've never seen this bug creep up in other circumstances.

In any case it's solved in IE 5.5

ppk

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com




More information about the Javascript mailing list