Something I whipped up in a few mins. This calculates purchase price to monthly cost. (replace all "$cript" with "script", "inerHTML" with "innerHTML", "change" to "onchange", and "click" to "onclick")
<pre class="code">
<html>
<body style="font-family:arial,helvetica">
<$cript language="javascript">
function calc_per_month() {
if (document.form1.purchase) {
var purchase_price = document.form1.purchase.value.replace(/$|,/g,'');
var down = Math.round(purchase_price * 0.2);
var mortgage = Math.round(purchase_price * 0.8);
var month_rate = 0.065/12;
var mortgage_payment = Math.floor((mortgage*month_rate)/(1-Math.pow((1+month_rate),(-1*360)))*100)/100;
var prop_tax = purchase_price * 0.01/12;
var insurance = purchase_price * 0.0025/12;
var stax = purchase_price * 0.0025/12;
var hoa = 100;
var maint = purchase_price * 0.015/12;
var monthly_cost = mortgage_payment + prop_tax + insurance + stax + hoa + maint;
var interest = mortgage * month_rate;
var tax_savings = -(interest + prop_tax) * 0.25;
var equity = -(monthly_cost - interest) * 0.25;
var lost = down*0.05/12;
var total_cost = monthly_cost + tax_savings + equity + lost;
document.getElementById('down').inerHTML = format_currency(down);
document.getElementById('mortgage').inerHTML = format_currency(mortgage);
document.getElementById('mortgage_payment').inerHTML = format_currency(mortgage_payment);
document.getElementById('property_tax').inerHTML = format_currency(prop_tax);
document.getElementById('homeowners_insurance').inerHTML = format_currency(insurance);
document.getElementById('special_taxes').inerHTML = format_currency(stax);
document.getElementById('hoa').inerHTML = format_currency(hoa);
document.getElementById('maint').inerHTML = format_currency(maint);
document.getElementById('monthly_cost').inerHTML = format_currency(monthly_cost);
document.getElementById('interest').inerHTML = format_currency(interest);
document.getElementById('tax_savings').inerHTML = format_currency(tax_savings);
document.getElementById('equity').inerHTML = format_currency(equity);
document.getElementById('lost').inerHTML = format_currency(lost);
document.getElementById('total_cost').inerHTML = format_currency(total_cost);
}
}
function format_currency(num) {
num = num.toString().replace(/$|,/g,'');
if(isNaN(num)) num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num % 100;
num = Math.floor(num/100).toString();
if(cents<10) cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num + '.' + cents);
}
</$cript>
<form name="form1">
Purchase Price: <input type="text" name="purchase" change="calc_per_month();" size="10"> <a href="#" click="calc_per_month();">Calculate</a>
</form>
Down Payment: <span id="down"></span>
Mortgage: <span id="mortgage"></span>
Mortgage Payment: <span id="mortgage_payment"></span> @ 6.5% 30yr
Property Taxes: <span id="property_tax"></span> @ 1%
Homeowners Insurance: <span id="homeowners_insurance"></span> @ 0.25%
Special Taxes and Levies: <span id="special_taxes"></span> @ 0.25%
Homeowners Association Dues or Fees: <span id="hoa"></span>
Maintenance and Replacement Reserves: <span id="maint"></span>
Monthly Cash Cost: <span id="monthly_cost"></span>
<span id="interest" style="margin-left:50px;"></span> Interest on First Payment
<span id="tax_savings"></span> Tax Savings @ 25% of mortgage interest and property taxes
<span id="equity"></span> Equity hidden in payment
<span id="lost"></span> Lost Downpayment Income @ 5% of Downpayment
Total Cost of of Ownership: <span id="total_cost"></span>
</body>
</html>
</pre>
Calculating monthly cost to purchase price will be left to the reader as an exercise.