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 4 of 4
  1. #1
    New Coder
    Join Date
    May 2003
    Posts
    70
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unhappy Canadian Mortgage Calculator

    Ok, so I've been hunting on the web for over 2 hours now for a decent Canadian javascript Mortgage Calculator for a client's website I am developing.

    So far I've come up empty handed.

    My client has asked specifically for the following fields to be asked for only:

    Property Purchase Price ($)
    Down Payment (%)
    Annual Interest Rate (%)
    Term (Years)

    From these amounts, the following calculations should be outputted:

    Mortgage Amount ($)
    Total Interest ($)
    Total Cost ($)
    Monthly Payment ($)

    A pretty close Flash example of what I'm after can be found here:

    http://www.canadarealestatenetwork.com/mortgages.html

    I'm not a coder, I'm a designer with minimal coding skills so this, I'm afraid is out of my scope of ability. Any assistance in locating a suitable script would be greatly appreciated.

    Many thanks in advance.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,908
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Google will reveal a good many examples of Mortgage Calculators - I expect that Canada is the same as anywhere else as far as compound interest is concerned.

    Here is an a example:-

    Code:
    <html>
    <head>
    
    <script type = "text/javascript">
    
    function floor(number) {
    return Math.floor(number*Math.pow(10,2) + 0.5)/Math.pow(10,2);
    }
    
    function dosum() {
      var mi = document.temps.IR.value / 1200;
      var base = 1;
      var mbase = 1 + mi;
      for (i=0; i<document.temps.YR.value * 12; i++) {
    base = base * mbase
    }
    
      document.temps.PI.value = floor(document.temps.LA.value * mi / ( 1 - (1/base)))
      document.temps.MT.value = floor(document.temps.AT.value / 12)
      document.temps.MI.value = floor(document.temps.AI.value / 12)
      var dasum = document.temps.LA.value * mi / ( 1 - (1/base)) +
    	document.temps.AT.value / 12 + 
    	document.temps.AI.value / 12;
      document.temps.MP.value = floor(dasum);
    }
    
    </script>
    
    </head>
    
    <body bgcolor = "FFFF70"><center>
    
    <form name ="temps">
    
    <HR>
    <H1>Put Inputs Here</H1>
    <table border = "3"3>
    <TD width=33%>
    Years: <input type = "text"  name="YR" onChange="dosum()" size="6" value="30">
    <TD width=33%>
    Interest: <input type = "text"  name="IR" onChange="dosum()" size="6" value="8.0">
    <TD>
    Loan Amount: <input type = "text"  name="LA" onChange="dosum()" size="6" value="100000">
    <TR>
    <TD width=33%>
    Annual Tax: <input type = "text"  name="AT" onChange="dosum()" size="6" value="1000">
    <TD width=33%>
    Annual Insur: <input type = "text"  name="AI" onChange="dosum()" size="6" value="300">
    <TD align = "center">
    <input type = button" value="Calculate Now!" onClick="dosum()">
    </TABLE>
    <P>
    <H1>Results</H1>
    <table border = "2">
    <TR>
    <TD>Monthly Prin + Int<TD><input type = "text"  name="PI" size="10"> 
    <TR>
    <TD>Monthly Tax <TD><input type = "text"  name="MT" size="10"> 
    <TR>
    <TD>Monthly Ins <TD><input type = "text"  name="MI" size="10"> 
    <TR>
    <TD>Total Payment <TD><input type = "text"  name="MP" size="10"> 
    </table>
    
    </form>
    
    </body>
    </html>

    BTW, the time to say "thanks" is afterwards, not beforehand which gives the impression that you take other people's unpaid assistance for granted. Or as British politician Neil Kinnock put it, "Don't belch before you have had the meal." Prefer to use "please" beforehand and if you find a response helpful then you can use the "Thank You For This Post" button.

  • #3
    New Coder
    Join Date
    May 2003
    Posts
    70
    Thanks
    1
    Thanked 0 Times in 0 Posts
    The particular example you have posted Philip, is one that I have already implemented for the client. They returned to me and specifically asked for the setup that I listed in my original post.

    And no, Canada isn't the same as everywhere else when it comes to compound interest from what I understand.

    "In Canada, mortgages are generally compounded semi-annual, which is twice per year."

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,908
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Well why not modify the script to double the number of periods and halve the annual interest rate?

    Principal $100000. No of Periods (years) 15. Interest rate 8&#37;. Monthly payment $955.69.

    Principal $100000. No of periods (half years) 30. Interest Rate 4% per half-year. Monthly payment $477.47 x 2 = $954.84.

    Not a very significant difference. Either way you will repay a total of around $172000 over the lifetime of the loan.


  •  

    Posting Permissions

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