var a = document.getElementsByTagName("li");
for(var i = 0,j = 1,len=a.length;i<len;i++;){
if((i + 1) % 2 ! = 0){
a[i].innerHTML = "第" + j + "名:"+a[i].innerHTML;
a[i].className = "red";
j++;
} else {
a[i].innerHTML = "第"+j+"名:"+a[i].innerHTML;
j++
}
}
兼容并包
相关分类