tr 背景属性似乎在 IE7 中不起作用。我想让行的 bgcolor 交替,然后当鼠标在行上时让它具有不同的颜色。所以我不能使用表格tbody tr.d1 td{background:#f1f1f1;}
,因为tbody tr.d1 td:hover{background:#f1f1f1;}
只会影响单元格的颜色,而不是整行......有人知道如何使这段代码工作吗?:
<html>
<head>
<script type="text/javascript" src="http://www.kryogenix.org/code/browser/sorttable/sorttable.js" ></script>
<style type="text/css">
table tbody tr.d1 td{background:transparent;}
table tbody tr.d2 td{background:transparent;}
table tbody tr.d1{background:#f1f1f1; color:#363636;}
table tbody tr.d2{background:white; color:#363636;}
table tbody tr.d1:hover, tr.d2:hover{background:#FFF5C3; color:#FF7260;}
</style>
</head>
<body>
<table class="sortable">
<thead>
<tr>
<th >Index</th>
<th><span class="nowrap">Parameter Name</span></th>
<th><span class="nowrap">Parameter Value</span></th>
<th><span class="nowrap">Page Name</span></th>
<th ><span class="nowrap">Page Name</span></th>
<th ><span class="nowrap">Page Name</span></th>
<th ><span class="nowrap">Page Name</span></th>
<th class="sorttable_nosort scrollbarCol"></th>
</tr>
</thead>
<tbody>
<tr class="d1">
<td>4_1</td> <td>gfryn</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d2">
<td>4_2</td> <td>aegr</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d1">
<td>4_3</td> <td>ryj</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d2">
<td>4_4</td> <td>styj</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d1">
<td>4_5</td> <td>rth</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d2">
<td>4_6</td> <td>srhfr</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d1">
<td>4_7</td> <td>sryh</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
<tr class="d2">
<td>4_8</td> <td>et5h</td> <td>4_2</td> <td>4_3</td> <td>4_3</td> <td>4_3</td> <td>4_3</td>
</tr>
</tbody>
</table>
</body>
</html>
[编辑]
javascript workarround 会是什么样子?