title: compare two fields in JavaScript
body: <p>I am making this form, it is fee calculator, it has two fields, Fee Due and fee Paid then there is one saying balance and lastly the 4th field is text field saying status it auto updated using JavaScript according to balance as Paid, Unpaid or Instalments it is working fine but only issue is for some reason when certain specific values are entered status field goes blank it doesn't update according to the JavaScript it should say instalments, here is my JavaScript</p>
  
  <pre><code>    function ff_feecalc_new_init()
      {
          setInterval("calc()", 500)
      } 
  
      function calc(){
  
          ff_getElementByName('status').value='';
          ff_getElementByName('balance').value=Number(ff_getElementByName('amountdue').value)-Number(ff_getElementByName('amountpaid').value);
  
          if (ff_getElementByName('amountpaid').value==0 &amp;&amp; ff_getElementByName('amountdue').value&gt;0){
  
              ff_getElementByName('status').value="unpaid";
          }
          if(ff_getElementByName('amountpaid').value&gt;0){
              if ((ff_getElementByName('balance').value &lt;ff_getElementByName('amountdue').value){
  
                  ff_getElementByName('status').value="installments";
              }
          }
  
          if (ff_getElementByName('amountpaid').value == ff_getElementByName('amountdue').value &amp;&amp; ff_getElementByName('amountpaid').value&gt;0){
  
              ff_getElementByName('status').value="paid";
          }
      }
  </code></pre>
  
  <p>Anything I am doing wrong?</p>