我先把CSS樣式放出來
body{margin:
/* 選中行樣式 */
我們再來看頁面HTML結構
<div id="page">
<table class="datagrid" cellpadding="
<thead>
<tr>
<th><input id="CheckAll" name="checkall" type="checkbox" /></th>
<th>ID</th>
<th>標題</th>
<th>發布人</th>
<th>發布時間</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center"><input type="checkbox" name="check" /></td>
<td align="center" width="
<td>阿裡做對了哪三件事?</td>
<td align="center" width="
<td align="center" width="
</tr>
<tr>
<td align="center"><input type="checkbox" name="check" /></td>
<td align="center" width="
<td>大盤點
<td align="center" width="
<td align="center" width="
</tr>
<tr>
<td align="center"><input type="checkbox" name="check" /></td>
<td align="center" width="
<td>如果智能手機市場有變
<td align="center" width="
<td align="center" width="
</tr>
<tr>
<td align="center"><input type="checkbox" name="check" /></td>
<td align="center" width="
<td>看看福特們是如何抵御谷歌蘋果的?</td>
<td align="center" width="
<td align="center" width="
</tr>
</tbody>
</table>
</div>
實現功能
$("
var oThis = $(this);
if (oThis
oThis
oThis
} else {
oThis
oThis
}
});
From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/25501.html