...

View Full Version : Really quick newb question on .hasAttribute DOM command



brookey86
04-03-2008, 07:16 PM
for (i=0; i<document.getElementsByTagName("td").length; i++)
{
if (document.getElementsByTagName("td")[i].hasAttribute("style"))
alert('yes and the position: ' + i);
}



Why does this .hasAttribute chunk give me a "Object doesn't support this property or method" error? This is supported by DOM, and there are multiple td tags on my page with the style attribute.

testing in IE.

brookey86
04-03-2008, 08:41 PM
I am getting on the right track. If you were not aware (as I was not), IE does not handle the .hasAttribute() and .getAttribute() tags correctly for "style" and "class". Instead of returning a string, as it should, it returns an object. I am currently working on a fix for this.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum