setAttribute + IE 6
this script updates an image on a page and resets the class name of a link. Works fine in Mozilla browser. However, the setAttribute method in the second function doesn't work in IE. Is there a known bug connected with this?
Any ideas? Thanks in advance.
var source = view.getAttribute("href");
var imgsrc = document.getElementById("view");
// update class names of links
var arLinks = document.getElementsByTagName("a");
var ct = (arLinks.length-1);
for (var i=0; i<ct; i++)
Try the following instead.
arLinks[i].className = "inactive";
view.className = "active";
The reason for this is that the serAttribute method is handled differently in different browers, if you user setAttribute('className', 'whatwhat') this will work in IE6, however not in FF, yet setAttribute('class', 'whatwhat') works in FF and not in IE6 for the the specific attricbute class="" you will have to either write a function to detect browser and use the relevant setAttribute mthod or use the code supplied... hope that helps explain a little