function mouseOver() {
if (!document.body.getElementsByTagName){ return; }
var allfields = new Array();
allDivs = document.body.getElementsByTagName("DIV");
for (var i=0; i<allDivs.length; i++){
var field = allDivs*;
if (field.getAttribute('class') == "greyBox") {
field.onmouseover = function () {this.className = 'greyBoxHover';}
field.onmouseout = function () {this.className = 'greyBox';}
}
}
}
I wrote this function to change the background of DIV’s going by the class “greyBox”. When the page loads it is initialised - it works in Firefox, but doesn’t in IE. As far as I know, getElementsByTagName is supported in both browsers - and I’ve tested for null returns.
Does anyone know why it doesn’t work in IE (5.5, 6)?