Я получаю эту ошибку «Не могу прочитать свойство« 0 »из null.»Невозможно прочитать свойство * 0 * of null
У меня есть таблица с
somename.html
<table>
<tr>
<td id="td1">text</td>
</tr>
</table>
somename.js
function test(){
var date=new Date();
if(date.getDay()==1 && date.getHours() >=13 && date.getMinutes() >=3){ //8-9AM
document.getElementById('td1')[0].style.color = 'blue';
}else if(date.getDay()==1 && date.getHours() == 14 && date.getMinutes() <= 20){
document.getElementById('td1')[0].style.color = 'blue';
}else{
//nothing
}
}
setInterval(test(),1000);
EDIT: новая ошибка, если я удалить [0] «Не удается прочитать свойство 'стиль' от нуля "
'java.js' заставляет меня съеживаться так же, как' php.py' :) – Lix
проблема с 'document.getElementById ('td1') [0]' Я думаю – dotNETbeginner
Используйте 'setInterval (test, 1000);' – Satpal