Изменить цвет столбца в зависимости от условия
Всем привет.
Есть фрагмент HTML: <th scope='col' class='dataValueRead cellCont ' style='width:86px;'><div class='divCont'><span class='wspan'></span><div class='cellIn'><input type="hidden" name="PTimesheetList3colWidthCache3" id="PTimesheetList3colWidthCache3" value="" /><nobr> Пн 21.01.13 </nobr></div></div></th> нужна javascript вставка чтобы закрасить бэкграунд этого элемента.
alert('Hello!');//просто дебажный алерт для проверки
var Color1= document.getElementById('PTimesheetList3colWidthCache3');
Color1.style.color = "green";
function UpdateColumnColor()
{
var Color1 = document.getElementById('PTimesheetList3colWidthCache3');
Color1.style.color = "green";
}
подскажите, что не так?? |
Так ведь PTimesheetList3colWidthCache3 - это скрытый элемент, он не отображается, какой смысл менять цвет его текста?
<th scope='col' class='dataValueRead cellCont ' style='width:86px;'>
<div class='divCont'><span class='wspan'></span>
<div class='cellIn'><input type="hidden" name="PTimesheetList3colWidthCache3" id="PTimesheetList3colWidthCache3" value="" /><nobr> Пн 21.01.13 </nobr>
</div>
</div>
</th>
<script>
(function(){
var cell = document.getElementById('PTimesheetList3colWidthCache3').parentNode;
cell.style.color = "green";
UpdateColumnColor = function()
{
cell.style.color = "green";
}
})();
</script>
|
| Часовой пояс GMT +3, время: 09:40. |