如何使用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