>> "How? Use innerHTML wherever possible. "<p>Terrible advice IMHO. True, innerHTML is faster in IE, so if you care about IE being slow (I don't), use innerHTML. However, innerHTML is buggy, has a bunch of caveats, and just looks incredibly ugly.<p><a href="http://www.quirksmode.org/dom/innerhtml.html" rel="nofollow">http://www.quirksmode.org/dom/innerhtml.html</a><p>On non-IE browsers, the difference in speed is negligible, and the code is far nicer using dom methods. (My browser SF/OSX reports 20ms for innerHTML, 25ms for DOM).<p>You also have useful references to nodes you might need later which makes code nicer and more optimum.
For example, you could do innerHTML=foo, then use getElementByID later to update one of the nodes in foo. But using the dom methods, you can just save the ref to the node when you create it yourself. You can also attach any event handlers easily as you go, rather than trying to cram them in the HTML (Even more eugh) or set them up afterwards.