However, using the DOM is often a performance killer... in general is much slower than innerHTML.
IE, Mozilla and Safari (among others) all supports innerHTML, so if you plan to generate a lot of html fragments and know the User-Agents that will access the pages, it might we worth to test the different methods...
Yes, the DOM is pretty nice to have sometimes :) I really like:
document.getElementsByTagName("<tagname>")
or even better:
document.getElementById("<id>").getElementByTagName("<tagname>")
..to get a nice collection of wanted elements....
However, using the DOM is often a performance killer... in general is much slower than innerHTML.
IE, Mozilla and Safari (among others) all supports innerHTML, so if you plan to generate a lot of html fragments and know the User-Agents that will access the pages, it might we worth to test the different methods...