为了在名单上的每一个第三个项目增加一个类别,我正在采取类似行动:
var projectElements = document.getElementById("projectList").children;
var iCount = 0;
for (var i in projectElements) {
iCount++;
if (iCount % 3 == 0) {
if (projectElements[i].className == "") {
projectElements[i].className += "projectLinkLast";
}
else {
projectElements[i].className += " projectLinkLast";
}
}
}
It works fine in Firefox and other browsers except for Internet Explorer 7. Does anybody have a clue why?