I haven’t done event-binding with plain JS in a long time…
so when I test on FF get error… attachEvent is not a function… so this is the one that works only in IE, right? (and I can’t test on IE right now… man, that’s just grand…)
so what do you need to do to not get errors on the browsers for which one of these two event-binding methods doesn’t work? you have to do browser-sniffing?
You might be interested to checkout the recent JavaScript Challenge thread. The idea was to convert a set of tabs that used jQuery into vanilla JS. There are some good links in the thread to further information, and several people have given JS functions for cross-browser event binding. AussieJohn’s solution is particularly well commented and useful to study IMO.