通过判断是否为单数即可
然后设置下行的背景颜色就可以了
if(i%2==1) row.style.background = "#CCCCff"; else row.style.background = "#CCCCCC";
具体请看下面的分析
用JS实现表格中隔行显示不同颜色
第一种:
tr{bgColor:expression( this.bgColor=((this.rowIndex)%2==0 )? 'white' : 'yellow'); }

通过判断是否为单数即可
然后设置下行的背景颜色就可以了
if(i%2==1) row.style.background = "#CCCCff"; else row.style.background = "#CCCCCC";
具体请看下面的分析
用JS实现表格中隔行显示不同颜色
第一种:
tr{bgColor:expression( this.bgColor=((this.rowIndex)%2==0 )? 'white' : 'yellow'); }