我有一个充满单元格的表格,如下所示:
<tr class="dataRow odd">
<td class="actionColumn"> someAction </td>
<th class=" dataCell booleanColumn" scope="row">
<img class="checkImg" width="21" height="16" title="Not Checked"
alt="Not Checked" src="/img/checkbox_unchecked.gif">
</img>
</th>
<td class=" dataCell "> SomeData </td>
</tr>
中间<th>
单元格将有一个带有title="Not Checked"
或的图像title="Checked"
。
如果title="Not Checked"
. 但是,我是 Greasemonkey 和 javascript 和 CSS 的新手。
我发现了这个类似的问题,但我不完全确定如何适应它。这看起来很接近,但不太正确,我不完全确定如何简单地更改行的 FG/BG 颜色。
var targetLinks = $("tr *dataRow*");
//--- Loop through the links and rewrite images that are in the same row.
targetLinks.each ( function () {
//--- This next assumes that the link is a direct child of tr > td.
var thisRow = $(this).parent ().parent ();
//--- This may need tuning based on information not provided!
var image = thisRow.find ("img");
//--- Replace all target images in the current row.
if ("Not Checked" == image.attr ('title')) {
//Apply Some formatting to thisRow
}
);
}
指针将不胜感激!