Junal on the run

Solving Javascript onclick() issue in IE6

Posted on: April 27, 2008

We always face css issues that work in FF/IE7 but not in IE6! That’s a common scenario. But Javascript? Well that’s too. Yesterday I faced this problem while I was working on an onclick event of JS.

To avoid the link execution I used href=”javascript:fx()” which worked fine in FF and IE7 but when I went to test with IE6 it all went wrong. Weird problem. Had no idea why it didn’t work and after goggling for sometimes I found the solution which was like instead of href=”javascript:fx()” I had to use href=”#” and my onclick was finished with “return false” to prevent the link from being executed. Nice trick! Google is the best!


1 Response to "Solving Javascript onclick() issue in IE6"

This is a known IE6 bug (that thankfully was fixed in IE7)

You’ll want to alter your fix to what is posted here

because you’re going to have issues with your posting. By using “#” your user will be scrolled to the top of the page (unwanted)… set a dummy hash value instead that will not cause scrolling “#ie6hack”.

There’s a new anchor bug in IE8 Beta 1 too! which will hopefully get fixed before ship time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

View Junal Rahman's profile on LinkedIn
Subscribe to me on FriendFeed

Follow Me on Twitter


My photos

Blog Stats

  • 425,753 hits
%d bloggers like this: