我有一个表头作为
<table class="tablestyle" id="tabHistory">
<tr>
<th style="min-width:15%;" onclick="javascript:doSort('0', 'Test Name');"> name</th>
<th style="min-width:18%;" onclick="javascript:doSort('1', 'platform');">Plat</th>
<th style="min-width:20%;" onclick="javascript:doSort('2', 'Test Server');"> Server</th>
<th style="width:3%;"></th>
<tr>
</table>
代码function doSort(index, column) {
var sortIndex = 'i' + index;
sortOrder[sortIndex] = (sortOrder[sortIndex] == "asc") ? "desc" : "asc";
var options = {"sortby":column, "order":sortOrder[sortIndex]};
displayHistory(options, function() {
var bgImg = (sortOrder[sortIndex] == "asc") ? "./images/asc.gif" : "./images/desc.gif";
$("#tabHistory th").eq(index).css({
"background-image": "url(" + bgImg + ")"
});
});
}
在表头中显示每个头中的图像。我希望仅在名称和服务器头中显示图像,而不是在平面头中显示图像。我如何从平面标题隐藏图像?
您可以使用:
$("#tabHistory th").eq(1).css("background-image", "none");
工作示例您可以使用.eq()
选择器:
$("#tabHistory th:eq(0),#tabHistory th:eq(2)").css({
"background-image": "url(" + bgImg + ")"
});
或者,您也可以从platth提交background-image,如下所示:
$( "#tabHistory tr th:contains('Plat')" ).css( "background-image", "" );