title: reset a drop down list value to previous value
body: <p>I am using javascript to validate some drop down list selections. One selection is for the length of a buildings frame. The other 3 drop down are for garage doors that can be added to the side. I have the code alerting me if the total door widths have exceeded the frame length. I need the if condition to take the previous value of the last selected door drop down list and reset it to the amount before it if the amount exceeds my conditions in my if statement.</p>
  
  <p>This is my html</p>
  
  <pre><code>Frame Length:
  &lt;select id="framewidth" onchange="doorsrightsideFunction()"&gt;
      &lt;option value="20"&gt;21&lt;/option&gt;
      &lt;option value="25"&gt;26&lt;/option&gt;
      &lt;option value="30"&gt;31&lt;/option&gt;
      &lt;option value="35"&gt;36&lt;/option&gt;
      &lt;option value="40"&gt;41&lt;/option&gt;
  &lt;/select&gt;
  &lt;br&gt;
  &lt;input type="hidden" name="eight_by_seven_width_right_side" 
         id="eight_by_seven_width_right_side" value="8"&gt;
  &lt;br&gt;
  &lt;input type="hidden" name="eight_by_seven_height_right_side" 
         id="eight_by_seven_height_right_side" value="7"&gt;
  &lt;br&gt;8x7:
  &lt;select id="eight_by_seven_right_side" onchange="doorsrightsideFunction()"&gt;
      &lt;option value="0"&gt;0&lt;/option&gt;
      &lt;option value="1"&gt;1&lt;/option&gt;
      &lt;option value="2"&gt;2&lt;/option&gt;
      &lt;option value="3"&gt;3&lt;/option&gt;
      &lt;option value="4"&gt;4&lt;/option&gt;
  &lt;/select&gt;
  &lt;br&gt;
  &lt;input type="hidden" name="nine_by_seven_width_right_side" 
         id="nine_by_seven_width_right_side" value="9"&gt;
  &lt;br&gt;
  &lt;input type="hidden" name="nine_by_seven_height_right_side" 
         id="nine_by_seven_height_right_side" value="7"&gt;
  &lt;br&gt;9x7:
  &lt;select id="nine_by_seven_right_side" onchange="doorsrightsideFunction()"&gt;
      &lt;option value="0"&gt;0&lt;/option&gt;
      &lt;option value="1"&gt;1&lt;/option&gt;
      &lt;option value="2"&gt;2&lt;/option&gt;
      &lt;option value="3"&gt;3&lt;/option&gt;
      &lt;option value="4"&gt;4&lt;/option&gt;
  &lt;/select&gt;
  &lt;br&gt;
  &lt;input type="hidden" name="ten_by_eight_width_right_side" 
         id="ten_by_eight_width_right_side" value="10"&gt;
  &lt;br&gt;
  &lt;input type="hidden" name="ten_by_eight_height_right_side" 
         id="ten_by_eight_height_right_side" value="8"&gt;
  &lt;br&gt;10x8:
  &lt;select id="ten_by_eight_right_side" onchange="doorsrightsideFunction()"&gt;
      &lt;option value="0"&gt;0&lt;/option&gt;
      &lt;option value="1"&gt;1&lt;/option&gt;
      &lt;option value="2"&gt;2&lt;/option&gt;
      &lt;option value="3"&gt;3&lt;/option&gt;
      &lt;option value="4"&gt;4&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>This is my javascript so far</p>
  
  <pre><code>function doorsrightsideFunction() {
  
      function getValue(idElement) {
          return document.getElementById(idElement).value;
      }    
      var eightwidth = getValue("eight_by_seven_width_right_side");
      var ninewidth = getValue("nine_by_seven_width_right_side");
      var tenwidth = getValue("ten_by_eight_width_right_side");
      var eightwidthamount = getValue("eight_by_seven_right_side");
      var ninewidthamount = getValue("nine_by_seven_right_side");
      var tenwidthamount = getValue("ten_by_eight_right_side");
      var framewidth = getValue("framewidth");
      var totaldoorwidth;
      var totaldooramount;
      var framewidthtotaldoorwidth;
      var framespace;
  
      totaldoorwidth = eightwidth * eightwidthamount
                     + ninewidth * ninewidthamount
                     + tenwidth * tenwidthamount;
  
      totaldooramount = parseInt(eightwidthamount, 10)
                      + parseInt(ninewidthamount, 10)
                      + parseInt(tenwidthamount, 10);
  
      framewidthtotaldoorwidth = framewidth - totaldoorwidth;
  
      framespace = totaldooramount + 1;
  
      if (framewidthtotaldoorwidth &lt; framespace) {
          alert("You have to many doors on the right side");
      } else { }
  }
  </code></pre>
  
  <p>here is a link to my fiddle <a href="http://jsfiddle.net/steven27030/M52Hf/" rel="nofollow">http://jsfiddle.net/steven27030/M52Hf/</a></p>