Avoid the void(0) in IE6
I recently learned the hard way that <a href="javascript:void(0)"> doesn’t work as expected in IE6. The solution is to use the familiar # but make sure your onclick event returns false:
<a href="#" onclick="aFunction();return false;">Link</a>
d’bug has a great writeup on why this works and the other doesn’t.
One Comment
→
You shouldn’t use inline javascript in your links like that period, though the onlick event isn’t as bad.
Ideally you’ll want to add a hook to your link like:
My Link
Then use a separate javascript file to add the click event to the link using the class as a way to identify it.