※ 貸款金額利率計算表 ※
|
<body bgcolor="#FFFFFF" <table border="0" background="jpg/01_bkg1.jpg"> <p align="center"><script language="JavaScript"> <!--Hide JavaScript from Java-Impaired Browsers function test_it(entry) { if (entry.value!=null && entry.value.length!=0) { entry.value=""+ eval(entry.value); } computeForm(entry.form); } function computeForm(form) { if ((form.months.value==null || form.months.value.length==0) || (form.rate.value==null || form.rate.value.length==0) || (form.financed.value == null || form.financed.value.length==0)) { return; } if (!alrt_msg(form.months,1,480,"你的付款期數") || !alrt_msg(form.rate,.001,99,"你填寫的利率") || !alrt_msg(form.financed,100,10000000,"貸款金額")) { form.payment.value="所填數值不在計算範圍內 - 請按重填"; return; } var i=form.rate.value; ffv=0; ffv+=form.financed.value; fmv=0; fmv+=form.months.value; if (i > 1.0) { // Hack to mostly correct floating point/binary conversion error i=(i/100.0)+.00001; var fmt=""; fmt+=i; fmt=fmt.substring(0,6) form.rate.value=fmt; } i/=12; var isn=1; for (var j=0;j<form.months.value;j++) isn=isn*(1+i); form.payment.value=(form.financed.value*isn*i)/(isn-1); fpv=0; fpv+=form.payment.value; var fmt=""; var add=9; fmt+=form.payment.value; for (var i=0;i<fmt.length;i++) { if (fmt.charAt(i)==".") { add=i+3; i=fmt.length; } } fmt=fmt.substring(0,add); fcalc=((fmv*fpv)-ffv); var fmtb=""; var add=9; fmtb+=fcalc; for (var i=0;i<fmtb.length;i++) { if (fmtb.charAt(i)==".") { add=i+3; i=fmtb.length; } } fmtb=fmtb.substring(0,add); form.payment.value=" NT$"+fmt+" NT$"+fmtb; } function reset_it(form) { form.months.value=""; form.rate.value=""; form.financed.value=""; form.payment.value=""; } function alrt_msg(entry,low,high,prompt) { prompt=prompt+" 你所輸入數值: "+entry.value; var scratch=entry.value; for (var i=0;i<scratch.length;i++) { var letter=scratch.substring(i,i+1); if ((letter<"0" || "9"<letter) && letter!='.') { alert(prompt); return false; } } var errtst=parseFloat(scratch) if (errtst<low || high<errtst) { alert("對不起. "+prompt+ " 不在計算範圍內" +" 從 "+low+" 到 "+high+"!"); return false; } entry.value=scratch; return true; } //--> </script></p> <hr> <form method="POST"> <div align="center"><center><table border="1" cellpadding="0" width="350" bordercolor="#0000FF" bgcolor="#00FFFF"> <tr> <td align="center" valign="top" colspan="3" bgcolor="#DEBD21">請填寫下面表格:</td> <td align="center" valign="top" bgcolor="#DEBD21">每月應付金額</td> <td align="center" valign="top" bgcolor="#DEBD21">你所應付的利息</td> </tr> <tr> <td align="center" bgcolor="#FFFF00">分期付款<br> 期數(月)<br> </td> <td align="center" bgcolor="#FFFF00">年利率(%)<br> </td> <td align="center" bgcolor="#FFFF00">貸款金額<br> </td> <td align="center" bgcolor="#FFFF00">你每月<br> 應付金額為<br> </td> <td align="center" bgcolor="#FFFF00">你應付出<br> 利息總金額為<br> </td> </tr> <tr> <td align="center"><input type="text" size="3" name="months" onchange="test_it(this)"> </td> <td align="center"><input type="text" size="5" name="rate" onchange="test_it(this)"></td> <td align="center">NT$<input type="text" size="8" name="financed" onchange="test_it(this)"></td> <td align="center" colspan="2"><input type="text" size="35" name="payment" onchange="test_it(this)"></td> </tr> <tr> <td align="center" colspan="2" bgcolor="#FFFF75"><input type="reset" value="重填金額" onclick="reset_it(this.form)"></td> <td align="center" colspan="3" bgcolor="#FFFF75"><input type="button" value="按一下,看每月需付金額與利息總額" onclick="computeForm(this.form)"></td> </tr> </table> </center></div> </form> |