For version codes above IE8, only CSS is required
tr{ background-color:expression('#F8F8F8,#EFEFEF'.split(',')[rowIndex%2]); }
For below IE8 The version code requires CSS and JS to be completed together:
First define two CSSs, the code is as follows:
.tr1{background-color:#fff;}
.tr2{background-color:#00ff;}
Actually write JS Code, the code is as follows:
onload=function(){
var trs=document.getElementById("tbid").getElementsByTagName("tr");//Get all tr information in the table of tbid
for(var i=0;i{
if(i%2==0)
trs[i].className="tr1";
else
trs[i].className="tr2";
}
}
Author:
chenhuziStatement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn