View Full Version : How to setup Payment Plan "Calculator"

01-02-2012, 05:11 PM
Hi All,

I need to create a page that is in a sense a Payment Calculator. What it needs to do is take a balance and divide it by a user selected number of months and then display how much must be paid each month to pay off the balance in that time period.

How would i set this up to work dynamically so if they decide they want a different number of months it will allow them to change it?

I would appreciate any help provided!:thumbsup:


01-02-2012, 05:57 PM
you might want to add some validation, but I think this is basically what you want to do:


<script type="text/javascript">

function calc(){
document.getElementById('result').innerHTML="Amount to pay per month: $"+amount/time;

Input balance: <input id="bal" type="text"/><br>
Number of monthly repayments: <input id="mon" type="text"/><br>
<input type="button" value="calculate" onclick="calc()"/><br>
<div id="result"></div>

Old Pedant
01-02-2012, 08:52 PM
CAUTION: If there is a finance charge on the amount due, as a percentage of the balance, then you can *NOT* simply divide by the number of months.