JavaScriptには、色を動的に変更する2行のコードがあります。1つはテーブル行の背景色を変更し、もう1つはフォントの色を変更します。
rows[i].style.backgroundColor = 'red'
rows[i].style.color = 'white'
特にハイパーリンクの場合、フォントの色を変更するには、もう1行のコードが必要です。私は試した:
rows[i].style.link.color = 'white'
と他のいくつかのバリエーションがありますが、リンクされたフォントの色を変更することができません。誰かがこれを手伝ってもらえますか?ありがとう。
完全なコード:
var INTENDED_MONTH = 7 //August
// INTENDED_MONTH is zero-relative
now = new Date().getDate(),
rows = document.getElementById('scripture').rows;
if (new Date().getMonth() != INTENDED_MONTH) {
// need a value here less than 1, or the box for the first of the month will be in Red
now = 0.5
};
for (var i = 0, rl = rows.length; i < rl; i++) {
var cells = rows[i].childNodes;
for (j = 0, cl = cells.length; j < cl; j++) {
if (cells[j].nodeName == 'TD'
&& cells[j].firstChild.nodeValue != ''
&& cells[j].firstChild.nodeValue == now) {
rows[i].style.backgroundColor = 'red'
rows[i].style.color = 'white'
rows[i].style.a.color = 'white'
$('html,body').delay(500).animate({ scrollTop: rows[i].offsetTop }, 2000);
}
}
}