form


  <!-- 
    This is an HTML form that allows the user to enter data and allows
    JavaScript to display the results it computes back to the user. The
    form elements are embedded in a table to improve their appearance.
    The form itself is given the name "loandata", and the fields within
    the form are given names such as "interest" and "years". These
    field names are used in the JavaScript code that follows the form.
    Note that some of the form elements define "onchange" or "onclick"
    event handlers. These specify strings of JavaScript code to be
    executed when the user enters data or clicks on a button.
  -->
  <form name="loandata">
    <table>
      <tr><td><b>enter loan information:</b></td></tr>
      <tr>
        <td>1) amount of the loan (any currency):</td>
        <td><input type="text" name="principal" onchange="calculate();"></td>
      </tr>
      <tr>
        <td>2) annual percentage rate of interest:</td>
        <td><input type="text" name="interest" onchange="calculate();"></td>
      </tr>
      <tr>
        <td>3) repayment period in years:</td>
        <td><input type="text" name="years" onchange="calculate();"></td>
      </tr>
      <tr><td></td>
        <td><input type="button" value="compute" onclick="calculate();"></td>
      </tr>
      <tr><td><b>payment information:</b></td></tr>
      <tr>
        <td>4) your monthly payment:</td>
        <td><span class="result" id="payment"></span></td>
      </tr>
      <tr>
        <td>5) your total payment:</td>
        <td><span class="result" id="total"></span></td>
      </tr>
      <tr>
        <td>6) your total interest payments:</td>
        <td><span class="result" id="totalinterest"></span></td>
      </tr>
    </table>
  </form>