! doctype html public '//W3C//dtd XHTML 1.0 transitional//en ' ' http://www.w3.org/tr/XHTML1/dtd/XHTML1- transiiiiii
html xmlns=' http://www.w3.org/1999/XHTML '
头儿
meta http-equiv=' content-type ' content=' text/html; charset=utf-8'/
titlejs计算器/title
script src='jquery.js'/script
脚本
$(functiongetperrepayment () {
varmoney=$('#inside.box_money ' ).val );
varrate=$('#inside.box_rate ' ).val );
var deadline=$ (' # inside.box _ deadline ' ).val );
var flag=money=='' ||! rate.match(/^[-] )? d*? . (d*$/)|| deadline==';
if(flag ) {
$('#inside .box_allpayment ' ).html(em0.00元em );
$('#inside .box_perRepayment ' ).html(em0.00元em );
}
else {
var ratePersent=rate/100/12;
var month=deadline;
varrepaymenttype=$ (' # inside.hkfs ' ).val ); //取下拉框中的值
var perRepayment;
var allpayment;
repayment type=='0' ) () ) (if ) ) ) ) )。
all payment=(money * rate persent * math.pow (1ratepersent ),month )math.pow ) )1rate persent ),month-1
per repayment=parsefloat (all payment )-parsefloat ) money;
}
elseif(repaymenttype=='1' ) }
per repayment=money * rate persent * deadline;
all payment=parsefloat (money * rate persent * deadline ) parsefloat (money );
}
$('#inside .box_perRepayment ' ).html('em(perRepayment * 10000 ).toFixed(2)2) )元/em );
$('#inside .box_allpayment ' ).html('em(allpayment * 10000 ).tofixed(2) )元/em );
}
() )
/head
div style='margin:0 auto; width:260px; height:200px; background-color:#CFC;'
H3 class=' tit _ GX ' style=' text-align : center; color:#F6F '计算器/h3
table cell padding='0' cellspacing='0' style=' text-align : left;'
tr
td金额/td
TD input type=' text ' class=' box _ money ' style=' border 33601 px solid # CCC;' /em万/em/td
/tr
tr
td年利率/td
TD input type=' text ' class=' box _ rate ' style=' border 33601 px solid # CCC;' /em%/em/td
/tr
tr
td期限/td
TD input type=' text ' class=' box _ deadline ' style=' border 33601 px solid # CCC;' /em月/em/td
/tr
tr
td偿还方式/td
td
! -下拉菜单框-
select class='hkfs '
option value='0'等值本息/option
option value='1' selected=' selected '月付款到期还款/option
/select
/td
/tr
tr
td style=' '预期收益/td
TD style=' border :1 px solid # CCC;' span class=' box _ per repayment '/span/TD
/tr
tr
td总额/td
TD style=' border :1 px solid # CCC;' span class=' box _ all payment '/span/TD
/tr
tr
td/td
tdinput type='button' value='计算' class=' BTN _ js 'nclick=' getperrepayment (;' ) //td
/tr
/table
/div
/body
/html