1. 程式人生 > >Jquery實現table偶行變色

Jquery實現table偶行變色

    <table id="demo" class="ui-table">
        <thead>
        <tr>
            <th style="width: 200px"><a id="createTime" href="javascript:void(0)">建立時間</a></th>
            <th>交易號</th>
            <th>金額</th>
            <th>狀態</th>
            <th>備註</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>2014-04-01 11:11</td>
            <td>10000</td>
            <td>$1128</td>
            <td>有效</td>
            <td>無</td>
        </tr>
        <tr>
            <td>2014-04-05 12:11</td>
            <td>10002</td>
            <td>$1218</td>
            <td>有效</td>
            <td>無</td>
        </tr>
        <tr>
            <td>2014-04-05 11:11</td>
            <td>10003</td>
            <td>$328</td>
            <td>有效</td>
            <td>無</td>
        </tr>
        <tr>
            <td>2014-04-04 02:11</td>
            <td>10004</td>
            <td>$628</td>
            <td>無效</td>
            <td>無</td>
        </tr>
        <tr>
            <td>2014-04-05 21:11</td>
            <td>10005</td>
            <td>$188</td>
            <td>有效</td>
            <td>無</td>
        </tr>
        </tbody>
    </table>

Jquery程式碼如下: