I get this error "Cannot read property '0' of null."
I have a table with
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: new error if i remove [0] "Cannot read property 'style' of null"
java.jsmakes me cringe just likephp.py:)document.getElementById('td1')[0]I guesssetInterval(test,1000);<head>section instead of in the<body>section?