title: Styling HTML with Javascript based on values
body: <p>I am trying to style an HTML table row based on values in that row, but I am stuck on step 1 - styling it at all!</p>
  
  <p>Here's the code I have:</p>
  
  <pre><code>&lt;tr id="tablerow&lt;%=j%&gt;"&gt;
  &lt;script type="text/javascript"&gt;
       document.getElementById("tablerow&lt;%=j%&gt;").style.backgroundColor = "red";
  &lt;/script&gt;
  </code></pre>
  
  <p>&lt;%=j> is pulling a row number in from the loop that's loading the data from the Access database as it loads the table. </p>
  
  <p>The table rows are not showing up as red!</p>
  
  <p>Then later I am going to use some IF statements in Javascript to color the rows based on data from some of the elements:</p>
  
  <pre><code>var datecheck = new Date;
  if (document.getElementById("confirmStatus&lt;%=j%&gt;").value=="P" &amp;&amp; (document.getElementById("confirmYear&lt;%=j%&gt;").value &lt; datecheck.getFullYear())) {
          document.getElementById("tablerow&lt;%=j%&gt;").style.backgroundColor = "LightCoral"; }
  </code></pre>
  
  <p>I was able to figure it out - thanks for the help!</p>