View Full Version : HTMLDivElement has no properties in IE6 (?)

01-20-2005, 11:58 PM
I am trying to use the function below in a tree-menu to toggle the visibility of child buttons via their style object. However, even though I get a list of divs back, all of which test OK as HTMLDivElement objects, I get an error in IE6 (SP2) whenever I try to access any of the properties (even length and toString() ) saying the property is not supported.

It all works fins in Opera and Mozilla.


var list = document.getElementsByTagName('div');
for(a=0; a<list.length; a++)
alert(list.a.className); // Falls over here
else alert('list.'+a+' is NOT an HTMLDivElement type object');

Any ideas?

01-21-2005, 12:40 AM
I seem to recall that elements have no prototype in IE... have you checked the documentation?

01-21-2005, 12:51 AM
That's right - HTMLElement prototyping isn't supported in IE

01-21-2005, 01:10 AM
DOM objects in ie are COM components. They don't even follow the JScript rules, much less the ECMAScript or DOM rules. (They do follow VBScript, VBA and VB6 rules rather strictly, though.)