...

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



jtgreenawald
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:

Thanks
Justin

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



<html>
<head>
<title></title>

<script type="text/javascript">

function calc(){
amount=document.getElementById('bal').value;
time=document.getElementById('mon').value;
document.getElementById('result').innerHTML="Amount to pay per month: $"+amount/time;
}
</script>
</head>
<body>

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>
</body>
</html>

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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum