Firefox vs. IE: innerHTML handling

前端 未结 4 859
梦毁少年i
梦毁少年i 2021-01-18 07:16

After hours of debugging, it appears to me that in FireFox, the innerHTML of a DOM reflects what is actually in the markup, but in IE, the innerHTML reflects what\'s in the

相关标签:
4条回答
  • 2021-01-18 07:20

    using a good library is a great way to get around browser inconsistencies, and jquery is the one that I typically recommend - and if you're running into issues altering the elements in a form in particular, jquery boasts a few really useful plugins focused specifically on form manipulation and evaluation.

    0 讨论(0)
  • 2021-01-18 07:24

    I agree with Pat. At this point in the game, writing your own code to deal with cross-browser compatibility given the available Javascript frameworks doesn't make a lot of sense. There's a framework for nearly any taste (some really quite tiny) and they've focused on really abstracting out all of the differences between the browsers. They're doing WAY more testing of it than you're likely to.

    Something like jQuery or Yahoo's YUI (think how many people hit the Yahoo Javascript in a day and the variety of browsers) is just way more road-tested than any snippet you or I come up with.

    0 讨论(0)
  • 2021-01-18 07:32

    I use jQuery's .html() to get a consistent result across browsers.

    0 讨论(0)
  • 2021-01-18 07:36

    Using prototype and the $("thisid") syntax instead of document.getElementById("thisid") might do the trick for you. It worked for me.

    0 讨论(0)
提交回复
热议问题