0
我有一個完整的,看起來像這種細胞的表:使用Greasemonkey根據一個單元格的內容更改行格式?
<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的新手。
我發現this similar question但我不完全確定如何適應它。這看起來很接近,但它並不完全正確,我不完全確定如何簡單地更改該行的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
}
);
}
指針將不勝感激!