title: Cannot read property *0* of null
body: <p>I get this error "Cannot read property '0' of null."</p>
  
  <p>I have a table with</p>
  
  <p>somename.html  </p>
  
  <pre><code>&lt;table&gt;  
      &lt;tr&gt;  
      &lt;td id="td1"&gt;text&lt;/td&gt;  
      &lt;/tr&gt;  
      &lt;/table&gt;
  </code></pre>
  
  <p>somename.js  </p>
  
  <pre><code>function test(){  
      var date=new Date();  
      if(date.getDay()==1 &amp;&amp; date.getHours() &gt;=13  &amp;&amp; date.getMinutes() &gt;=3 ){ //8-9AM  
          document.getElementById('td1')[0].style.color = 'blue';  
      }else if(date.getDay()==1 &amp;&amp; date.getHours() == 14  &amp;&amp; date.getMinutes() &lt;= 20){  
              document.getElementById('td1')[0].style.color = 'blue';  
      }else{  
        //nothing  
      }  
  }  
  setInterval(test(),1000);
  </code></pre>
  
  <p>EDIT: new error if i remove [0] "Cannot read property 'style' of null"</p>