My IE is IE 6. It's pretty old, but I have to use it.
I just found a strange problem, it doesn't support "document.getElementById()"!
See my test file: test.html
<a id="aaa">xxx</a>
<script>
aaa = document.getElementById("aaa");
alert(aaa);
</script>
When I open this file by IE, there shows an ERROR dialog:
line: 3
char: 1
error: object doesn't support the attribute or method
code: 0
URL: file://D:/test.html
Do I made some mistakes? It's so strange ~
Its because the anchor element is set up (in IE6) as a global variable with name aaa. And then you are trying to use another variable with same name.
If you change it to...
<a id="aaa">xxx</a>
<script>
bbb = document.getElementById("aaa");
alert(bbb);
</script>
it should work.
See http://verens.com/2005/03/18/getelementbyid-bug-in-ie6/
Change the variable name so that its not the same as the element id.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With