Solution for IE6 setAttribute bug
October 6, 2007
If you ve been trying to use the setAttribute function to dynamically change the properties of an HTML element and wondering what to do when it fails on Internet Explorer 6 then here s something that most definitely works:
var oDiv = document.getElementById(“div_name”);
Instead of typing
oDiv.setAttribute(“style”, “color:#666;”);
Simply access that property directly by Javascript
oDiv.style.cssText = “background-color:#666″;
This works on ie6 ie7 and ff. I havent checked in Netscape.
I found this solution here
http://www.quirksmode.org/bugreports/archives/2005/03/setAttribute_does_not_work_in_IE_when_used_with_th.html
It is the 5th comment on the page by Rob.(http://blog.throbs.net/)