My Blog On .NET

and some other stuff too
posts - 18, comments - 6, trackbacks - 2

href=”javascript:void(0)”

I spent better part of the day trying to troubleshoot why my photo viewer Ajax control was not showing any photos under IE 6. After barking up the wrong tree I later found out that the reason was due to the fact that I call calling the control using a link where the href was set to "javascript:void(0)" and calling my function through the onclick event. I did not know this was a bug under IE 6 because up until now I've always used "#" in the href which is the workaround. Well to be more exact the complete way to handle this issue is the following:

<a href="#" onclick="myFunctionCall();return false">Link Text</a>

By returning false at the end of the function call keeps the link from performing it default behavior of following the link.

Print | posted on Tuesday, July 10, 2007 6:07 PM |

Powered by: