Home > Development > Disappearing text in IE6 and "dead" JavaScript links

Disappearing text in IE6 and "dead" JavaScript links

December 1st, 2007 Leave a comment Go to comments

We discovered a couple little annoyances with IE6, and I thought it would be useful to publish their workarounds.

Issue #1:

Random text would "disappear" on a page. It actually was still there and would show sometimes after hovering over it. The fix turns out to be setting the CSS for the text in question to "height: 0.01%" - it's so simple but so needless. It shouldn't have to be done. It should just work.

Issue #2:

<a href="javascript:anything" onclick="something()">

Won't work. It will just act like a dead link (or perhaps just ignore the onclick...) This will work however:

<a href="javascript:something()">

Note: Typically I try to keep my href's to be plain "javascript:;" if I need to use anchor-based links, and then chain events off of it using the element's ID and jQuery.

Categories: Development
  1. Sergi
    April 14th, 2008 at 13:34 | #1

    I think the correct syntax for empty javascript links is javascript:void(0). I'm unable to find the documentation right now, but it seems that in javascript syntax that's the way for a function returning null.

  2. mike
    April 14th, 2008 at 22:02 | #2

    In the past I swore void(0) makes other actions tied to that link not execute. I'm too lazy to try it now 🙂 But for some reason I have it in my head to not use void. Or maybe, it was void(), and void(0) is okay? Oh well.

    I have not had any issues with "javascript:;" as of yet though. Perhaps the next time I need to write some code like that I will try void(0) - but I haven't coded any pseudo-dead links like that recently.

  1. No trackbacks yet.
You must be logged in to post a comment.