如何使用jQuery爲偶數(或奇數)表格列着色? (不添加人工班)jQuery:突出顯示偶數列(不是行)
我的標記是:
<table>
<caption>Table caption</caption>
<thead>
<tr><th scope="col">Table header 1</th><th scope="col">Table header 2</th><th scope="col">Table header 3</th><th scope="col">Table header 3</th></tr>
</thead>
<tbody>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
</tbody>
</table>
(它可能會或不會包含範圍attribs或th
標籤)
+1:感謝您對我的回答您的評論,在這裏提供正確的解決方案。 – Sarfraz 2010-07-06 15:21:43
謝謝,這一個工作正常(以前的版本做過某種跳棋;) – Adrian 2010-07-06 15:27:46
需要更多代表upvote :) – Adrian 2010-07-06 15:28:30