title: car loan instalment calculator javascript
body: <p>this is my coding that im working to calculate instalment for car loan. but it seems my calculate button not working. i dont know what is my mistake. if anybody could help that would be nice.
  newbie programmer here.</p>
  
  <pre><code>    &lt;table&gt;
          &lt;tr&gt;&lt;td&gt; Car Price (RM): &lt;/td&gt;
              &lt;td&gt;&lt;input type = "text" name = "txtPrice" size = "10" onchange="calculate();"&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;&lt;td&gt; (Retail Purchase Price) &lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;&lt;td&gt; Down Payment (RM): &lt;/td&gt;
              &lt;td&gt;&lt;input type = "text" name = "txtDownPayment" size = "10" onchange="calculate();"&gt;&lt;/td&gt;
              &lt;td&gt; (minimum of 10% of car price) &lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;&lt;td&gt; Interest Rate (%): &lt;/td&gt;
              &lt;td&gt;&lt;input type = "text" name = "txtInterest" size = "10" onchange="calculate();"&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;&lt;td&gt; Loan Duration: &lt;/td&gt;
              &lt;td&gt;&lt;input type = "text" name = "txtDuration" size = "5" onchange="calculate();"&gt;&lt;/td&gt;
              &lt;td&gt; (year) &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  
      &lt;br&gt;
      &lt;table&gt;
          &lt;tr&gt;&lt;td&gt;&lt;input type = "button" value = "Calculate" onClick = "calculate();"&gt;&lt;/td&gt;
              &lt;td&gt; RM &lt;/td&gt;
              &lt;td&gt;&lt;input type = "text" name = "txtLoanInstallment" size =  "10"&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  
      &lt;script language = "JavaScript"&gt;
      function calculate()
      {
          var price, downPayment, interest, duration, tenPercent, loan, totalLoan;
          price = parseDouble (document.form1.txtPrice.value);
          downPayment = parseDouble (document.form1.txtDownPayment.value);
          interest = parseDouble (document.form1.txtInterest.value);
          duration = parseInt (document.form1.txtDuration.value);
          tenPercent = (downPayment/price * 10);
          loan = price - tenPercent;
          totalLoan = (loan + (loan * interest*0.01) * duration) / (duration * 12);
          document.form1.txtLoanInstallment.value = totalLoan.toFixed(2);
      }
      &lt;/script&gt;
  </code></pre>