function calculate(loan_amt,months,rate,extra){
i = rate/100
var comp_int = Math.pow((1+i/12),months)
var monthly_pmt = loan_amt*(i/12)*comp_int/(comp_int - 1);
alert (Math.round(monthly_pmt*100)/100);
var info ="";
info +="<table width ='250'>"
//htmlコードを書くという書式
info +="<tr><td> Loan Amount: </td>";
info +="<td align='right'>"+loan_amt+"</td></tr>";
info +="<tr><td> Monthly Payment: </td>";
info +="<td align='right'>"+Math.round(monthly_pmt,2)+"</td></tr>";
info +="</table>";
document.getElementById("loan_info").innerHTML = info;
//html内のdiv id = loan_infoに書き出せというコマンド}
0 件のコメント:
コメントを投稿