表格隔行换色,节省代码的好方法
<style>
.db { border-collapse:collapse}
.db tr{ background-color:expression('#F8F8F8,#EFEFEF'.split(',')[rowIndex%2]) }
</style>
<table width="100%" border="1" class="db">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
上面是每一行隔行换色每两行一循环,下面是每一行隔行换色,每八行一循环
<style>
.db tr{
background-color:expression('#000000,#333333,#555555,#777777,#999999,#bbbbbb,#dddddd,#ffffff'.split(',')[rowIndex%8])
}
</style>