IE innerHTML – “Unknown runtime error”

Setting value of <div id=”divhtml”> using js like this :

document.getElementById(“divhtml”).innerHTML = “<form><input type=”text”>…</form>”;

it was giving me error..

Solution:

oldDiv = document.getElementById(divhtml);
newDiv = document.createElement(oldDiv.tagName);
newDiv.id = oldDiv.id;
newDiv.className = oldDiv.className;
newDiv.innerHTML = “<form><input type=”text”>…</form>”;

oldDiv.parentNode.replaceChild(newDiv, oldDiv);

And it worked like a charm!!!!!!

Link : http://piecesofrakesh.blogspot.com/2007/02/ies-unknown-runtime-error-when-using.html

8 Comments

  • I’m extremely impressed with your writing skills and also with the layout on your weblog. Is this a paid theme or did you customize it yourself? Either way keep up the excellent quality writing, it is rare to see a nice blog like this one these days.

    • Thanks for the nice words!

      It’s default theme!

      Sincerely,
      Kiran Patil

  • Fine way of telling, and nice piece of writing to obtain facts on the topic of my presentation subject, which i am going to
    convey in college.

  • This design is spectacular! You certainly know how to keep a
    reader entertained. Between your wit and your videos,
    I was almost moved to start my own blog (well, almost…HaHa!
    ) Excellent job. I really enjoyed what you had to say, and more than that, how
    you presented it. Too cool!

  • Howdy! This post could not be written any better!
    Reading through this post reminds me of my previous room mate!
    He always kept talking about this. I will forward this article to him.
    Pretty sure he will have a good read. Many thanks for sharing!

  • You really make it seem so easy with your presentation but I find this topic to be really something that I think I would never understand.
    It seems too complex and very broad for me. I am looking forward for
    your next post, I’ll try to get the hang of it!

Comments are closed.