...

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



Hoggle
01-20-2005, 10: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.

Code:

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


Any ideas?

codegoboom
01-20-2005, 11:40 PM
I seem to recall that elements have no prototype in IE... have you checked the documentation?

brothercake
01-20-2005, 11:51 PM
That's right - HTMLElement prototyping isn't supported in IE

liorean
01-21-2005, 12: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.)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum