次のようなセルでいっぱいのテーブルがあります。
<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
}
);
}
ポインターをいただければ幸いです。