title: How to get and set value to html tag using array in javascript?
body: <p><strong>I want to highlight color to many rows if its date value passes my condition as below code</strong></p>
  
  <p>I'm retrieving <strong>from_date</strong> and <strong>to_date</strong> from database by using foreach() in php and I will extract it into rows of table and I want to highlight with red color to some rows of table if <strong>from_date</strong> and <strong>to_date</strong> value pass my condition as below javascript</p>
  
  <p>But I don't know how to do it with javascript code to find all <strong>id</strong> selector of html and set its color to red,black,blue if <strong>from_date</strong> and <strong>to_date</strong> passes condition.</p>
  
  <pre><code>&lt;table&gt;
     &lt;tr class="highlight"&gt;
        &lt;td&gt;ID:&lt;/td&gt;
        &lt;td id="from"&gt;From Date: 2014-11-28&lt;/td&gt;
        &lt;td id="to"&gt;To Date: 2014-11-30&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr class="highlight"&gt;
        &lt;td&gt;ID:&lt;/td&gt;
        &lt;td id="from"&gt;From Date: 2014-11-28&lt;/td&gt;
        &lt;td id="to"&gt;To Date: 2014-11-28&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr class="highlight"&gt;
       &lt;td&gt;ID:&lt;/td&gt;
       &lt;td id="from"&gt;From Date: 2014-11-28&lt;/td&gt;
       &lt;td id="to"&gt;To Date: 2014-11-28&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr class="highlight"&gt;
       &lt;td&gt;ID:&lt;/td&gt;
       &lt;td id="from"&gt;From Date: 2014-11-28&lt;/td&gt;
       &lt;td id="to"&gt;To Date: 2014-12-01&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr class="highlight"&gt;
       &lt;td&gt;ID:&lt;/td&gt;
       &lt;td id="from"&gt;From Date: 2015-01-01&lt;/td&gt;
       &lt;td id="to"&gt;To Date: 2015-01-30&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tabl&gt;
  </code></pre>
  
  <hr>
  
  <p>As above html code I want to use array in javascript to check all id html selector to check its <strong>from_date</strong> and <strong>to_date</strong> value and set red color to highlight class (<strong>class="highlight"</strong>) by condition.</p>
  
  <pre><code>            &lt;script&gt; 
              var today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
              var from_day = document.getElementById("from");
              var to_day   = document.getElementById("to");
              var highlight = [];
  
              var get_from_day = new Date(from_day);
              var get_to_day   = new Date(to_day);
  
              var i = document.getElementById();
  
              if(get_from_day.getTime() == get_to_day.getTime()){
                   highlight[] = "red";
                          }
              if(get_from_day.getTime() &gt; get_to_day.getTime()){
                  highlight[] = "blue";
                          }
              if(get_to_day.getTime() == today.getTime()){
                  highlight[] = "black";
              }else{
                  if(highlight){
                      for(i=0;i&lt;=;i++){
              document.getElementById("highlight").style.background-color = highlight;
                          }
                  }
              } 
          &lt;/script&gt;
  </code></pre>
  
  <p>Thanks advance for help</p>