title: Changing text colour or background depending on value of input field
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/197748/how-do-i-change-the-background-color-with-javascript">How do I change the background color with Javascript?</a>  </p>
  </blockquote>
  
  
  
  <p>I have this javascript function which works fine but I wanted to add to it.</p>
  
  <p>The Risk is calculated by multiplying the severity by the likelihood.  The calculation is done by the function below validate_form()</p>
  
  <p>The colour according to values is:</p>
  
  <ul>
  <li>Green -  less than 6 the input field changed colour to green<br /></li>
  <li>Orange - between 6 - 9<br /></li>
  <li>Red - if more than 9<br /></li>
  </ul>
  
  <p>The risk value writes to and input field named "risk1" "risk2" etc.</p>
  
  <pre><code>function validate_form ( ) {
      valid = true; 
  
      document.calc.risk1.value = document.getElementById('data_1_severity').value*document.getElementById('data_1‌​_likelihood').value;
      document.calc.risk2.value = document.getElementById('data_2_severity').value*document.getElementById('data_2‌​_likelihood').value; 
  
      return valid;
  }
  </code></pre>
  
  <p>Could someone help me with this?  Just want either the risk score to change color depending on value or the background of the cell to change colour -  not really bothered.  This will show then if the risk is:</p>
  
  <ul>
  <li>Green - Low Risk<br /></li>
  <li>Orange - medium risk</li>
  <li>Red - high risk.</li>
  </ul>