title: HTML form field update on another field change
body: <p>I have a form that updates a total based on the field values entered on a form when the user leaves each field.
  This works fine but I also want to update one of the entry fields which is a percentage of another.</p>
  
  <p>I have in my js</p>
  
  <pre><code>var theForm = document.forms[frm];
  var eTotal = theForm.elements["Total"];
  var ePremium = theForm.elements["Premium"];
  if (eTotal.value &gt; 0) {
      var PremAmount = parseFloat(eTotal.value * ePremium.value / 100);
  }
  var divobj = document.getElementById('PremAmount');
  divobj.innerHTML = PremAmount.toFixed(2);
  </code></pre>
  
  <p>Which is called with</p>
  
  <pre><code>onblur="addPrem('totals')"
  </code></pre>
  
  <p>The original value in the totals field from the MySQL table is 770.00
  My php script produces the following html</p>
  
  <pre><code>&lt;input name="PremAmount" tabindex="1" class="ent" id="PremAmount" size="2" value="77.00"&gt;
  </code></pre>
  
  <p>When I change the total to 888.00 I get the following </p>
  
  <pre><code>&lt;input name="PremAmount" tabindex="1" class="ent" id="PremAmount" size="2" value="77.00"&gt;88.80&lt;/input&gt;
  </code></pre>
  
  <p>So it looks like it's working but writing a div rather than into the field itself</p>
  
  <p>Can anyone help me with this please</p>