View Full Version : Canadian Mortgage Calculator

05-06-2008, 08:57 AM
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:


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.

Philip M
05-06-2008, 10:05 AM
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:-


<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);



<body bgcolor = "FFFF70"><center>

<form name ="temps">

<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">
Loan Amount: <input type = "text" name="LA" onChange="dosum()" size="6" value="100000">
<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 border = "2">
<TD>Monthly Prin + Int<TD><input type = "text" name="PI" size="10">
<TD>Monthly Tax <TD><input type = "text" name="MT" size="10">
<TD>Monthly Ins <TD><input type = "text" name="MI" size="10">
<TD>Total Payment <TD><input type = "text" name="MP" size="10">



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.

05-06-2008, 10:11 AM
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."

Philip M
05-06-2008, 11:45 AM
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.