For Interest, you may find this lecture by John Resig interesting. Its relevant to new and experienced users alike when using dom methods like you are.
It discusses many lovely caveats of dom methods in many browsers.
One such, is that getElementsByTagName(“*”)
will return no elements in IE5, and does weird things with Objects + getElementsByTagName("*")
under IE7, and according to the talk, it makes this:
<a id="length"></a>
Perform as if somebody had done:
var a = getElementsByTagName("a");
a.length = ""; # This overrides the arrays length attribute :/
So that you can't iterate the array.
I don't know which javascript libraries circumvent this flaw, but you really should use one to avoid cross-browser headaches.