改变表格奇数行的颜色
-----改变表格奇数行的颜色---------------
<table border=1 id=tab1>
<tr><td>aaa</td><td>bbb</td></tr>
<tr><td>aaa</td><td>bbb</td></tr>
<tr><td>aaa</td><td>bbb</td></tr>
<tr><td>aaa</td><td>bbb</td></tr>
<tr><td>aaa</td><td>bbb</td></tr>
<tr><td>aaa</td><td>bbb</td></tr>
</table>
<script language=javascript>
var a = document.all.tab1.getElementsByTagName("tr");
for (var i=0; i<a.length; i++)
{
a[i].style.background=(i%2==1) ? "#C0C0C0" : "#FFFFFF";
a[i].style.display="none"; //none隐藏, block显示
}
</script>