More DOM stuff
So, a few more random observations on
DOM browser compatibility.
First, don't bother using
element.setAttribute('class', 'someclass'). Oh, it looks fine in
Firefox, but it won't
do squat in Internet
Explorer. Use element.className = 'someclass' instead, which
seems to work in both browsers. (The problem I noticed, if someone catches
this in a search, is that no errors were
being raised anywhere, but the styles I specified in the stylesheet weren't
being applied in IE. I have no idea if this problem applies to other element
attributes. I found a reference to the solution at
WebmasterWorld.)
Next, dynamically creating DOM objects in JavaScript is cool.
By being
able to yank the navigational aids out of the
HTML source, browsers
like Lynx and
ELinks render with less useless fluff, and
if you disable JavaScript in your browser, it "just works" (and looks
basically correct).
Finally, I am amazed at how well Opera
"just works". I didn't have to touch anything at all to make Opera render
everything as I wanted; as far as I can tell, it behaved exactly like
Firefox in most cases (specifically, it looks like they implemented the
W3C
DOM Events
specification). Happiness.

). Andy's code has the additional benefit of
handling nested event handlers in a very slick manner.