table使用了border-collapse:collapse;
.ana table tr td{ border-bottom:1px #E9E9E9 solid; border-left: 1px #E9E9E9 solid;}
而不是.ana table tr td{ border:1px #E9E9E9 solid; }
添加样式.selected{ border: 1px #169CF4 solid !important;}
使用jq触发鼠标移入和移除事件,添加和移除样式,类似:
$(document).ready(function () {
$("#fir_th").mouseover(function () {
$("#fir_tr_1").addClass("selected");
$("#fir_tr_2").addClass("selected");
$("#fir_tr_3").addClass("selected");
$("#fir_tr_4").addClass("selected");
});
$("#fir_th").mouseout(function () {
$("#fir_tr_1").removeClass("selected");
$("#fir_tr_2").removeClass("selected");
$("#fir_tr_3").removeClass("selected");
$("#fir_tr_4").removeClass("selected");
});
});
html:
<table>
<tr>
<th width="108px" id="fir_th"> 列内容 </th>
<th width="308px" id="sec_th">列内容 </th>
<th width="429px" colspan="2" id="thi_th">列内容 </th>
</tr>
<tr >
<td id="fir_tr_1">列内容 </td>
<td id="sec_tr_1">列内容 </td>
<td id="thi_tr_11">列内容 </td>
<td id="thi_tr_12"> 列内容 </td>
</tr>
</table>