<HTML >
<HEAD >
<TITLE >HTML网页中行与行间隔的表格就是上行与下一行用不同颜色</TITLE >
<script type="text/javascript">
function fun(){
var tr=document.getElementsByTagName("tr");
for(var i=0;i<tr.length;i++)
{
tr[i].style.background=tr[i].rowIndex % 2==0?"#F0FFF0":"white";
}
}
window.onload=fun;
</script>
</HEAD >
<BODY >
<table>
<tr > <th >123 </th > <th >aaa </th > <th >bcx </th > </tr >
<tr > <td >sadfsadf </td > <td >ssdf </td > <td >sde </td > </tr >
<tr > <td >asfdf </td > <td >fds </td > <td >fdfsa </td > </tr >
<tr > <td >sdf </td > <td >sdf </td > <td >fdsaf </td > </tr >
<tr > <td >0aasfd </td > <td >asdf </td > <td >asdf </td > </tr >
</table >
</BODY >
</HTML >
http://www.cnblogs.com/JAMJIA/archive/2010/03/05/1679469.html