Another IE Bug

Posted on Jan 13 2005 04:24pm by Luke Davison

This afternoon, I have been working to find out why in Internext Explorer (IE) I can't set the innerHTML value of a SPAN element without IE throwing a "Unknown Runtime Error". Of course, the SAME code works flawlessly in Mozilla/Firefox (Gecko really). First thing I did was consult the MSDN pages for innerHTML, and guess what it says? In a nutshell, it states it should work.

This made me think. Maybe I'm not passing the correct HTML or something stupid like that. So, I started removing elements until I had Testing. That worked. But, I am trying to use

    and
  • . What I found out through trial and error is that you can set SOME elements using innerHTML in IE, but not all of them. So far, the ones that fail are

    ,

      ,
    • , I haven't tested many others. I was able to use CSS and SPAN's to hack around this problem. Just extremely annoying that one has to do that in the first place.

       

      What I wanna know is when the fuck Microsoft will wake up and smell the fucking coffee? How about a browser that actually works fellas? - FUCK!

 

Comments

Anonymous said:
the TR tag also doesn't work, span's to rescue

Anonymous said:
It's by design, read the specs

Man-Chicken said:
This seems to be a problem with the setter for innerHTML. If the data assigned to innerHTML isn't liked by the IE HTML parser, you get this error.

Anonymous said:
here's my code that causes Unknown Error:

document.getElementById("debug").innerHTML="testing";

please, oh please tell me how is this by design ?

Luke Davison said:
All I can say is hopefully Microsoft will try and get it right in IE 7.

bilnaaD said:
hi, i discovered the reason: you cannot add block elements (like div, p, ul) to an inline element (like span). try using a div with display = inline instead of a span. good luck!
ps: excuse me for my bad english, i'm from holland

mario.julia4 said:
Your blog is very much useful and rocking dear. you have provided detailed knowledge and information about today's latest technologies, online communications and other businesses. If you want to get the knowledge of latest technologies, then you must take a latest information. For the some developing success, you can get information about cheap web hosting. Thanks a lot for your great post. I really enjoy your post and also wait for your latest posts. Well done.