title: Setting the style property for table rows using javascript
body: <p>Assume I have a page like this </p>
  
  <pre><code>&lt;html&gt;    
      &lt;body&gt;
          &lt;table id="t1"&gt;
              &lt;tr&gt;&lt;th&gt;Head1&lt;/th&gt;&lt;th&gt;Head2&lt;/th&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt;
        &lt;/table&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My CSS </p>
  
  <pre><code>table th { background:color1;} 
  table td { background:color2;}
  </code></pre>
  
  <p>How do I change the background color for all rows except header row with a javascript statement. Is looping through each row and column the only method? </p>
  
  <p>I can get <code>document.getElementById('t1').rows[1]</code> and <code>rows[2]</code> and change background. But is there another efficient way?   </p>