Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to setup Payment Plan "Calculator"

    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!

    Thanks
    Justin

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,771
    Thanks
    55
    Thanked 518 Times in 515 Posts
    you might want to add some validation, but I think this is basically what you want to do:

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

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •