js计算贷款金额怎么算

js实现贷款能力计算方法有哪些,js计算贷款金额怎么算代码教程如下:

1.自定义现持有资金

2.自定义现家庭月收入

3.自定义家庭月固定支出

4.自定义您期望贷款年限

5.自定义计划购买房屋面积

计算结果:计算当前收入金额配置下购房最大金额

js实现代码:


function myround(v, e) {
var t = 1;
e = Math.round(e);
for (; e > 0; t *= 10, e--);
for (; e < 0; t /= 10, e++);
return Math.round(v * t) / t;
}

function ShowLilv(month, lt) {
var indexNumSd = getArrayIndexFromYear(month, 1); // 鍟嗚捶
var indexNumGj = getArrayIndexFromYear(month, 2); // 鍏Н閲�
$("sdlv").innerHTML = myround(lilv_array[lt][1][indexNumSd] * 100, 2) + "%";
$("gjlv").innerHTML = myround(lilv_array[lt][2][indexNumGj] * 100, 2);
}
function ShowLilvNew(month, lt) {
var indexNumSd = getArrayIndexFromYear(month, 1); // 鍟嗚捶
var indexNumGj = getArrayIndexFromYear(month, 2); // 鍏Н閲�
if ($('type').value == 1) {
$("singlelv").value = myround(lilv_array[lt][1][indexNumSd] * 100, 2);
} else if ($('type').value == 2) {
$("singlelv").value = myround(lilv_array[lt][2][indexNumGj] * 100, 2);
} else {
$("singlelv").value = myround(lilv_array[lt][2][indexNumGj] * 100, 2);
}
$("sdlv").value = myround(lilv_array[lt][1][indexNumSd] * 100, 2);
$("gjlv").value = myround(lilv_array[lt][2][indexNumGj] * 100, 2);
}
function getArrayIndexFromYear(year, dkType) {
var indexNum = 0;
if (dkType == 1) {
if (year == 1) {
indexNum = 1;
} else if (year > 1 && year <= 3) {
indexNum = 3;
} else if (year > 3 && year <= 5) {
indexNum = 5;
} else {
indexNum = 10;
}
} else if (dkType == 2) {
if (year > 5) {
indexNum = 10;
} else {
indexNum = 5;
}
}
return indexNum;
}
function exc_zuhe(fmobj, v) {
//var fmobj = document.calc1;
if (fmobj.name == "calc1") {
if (v == 3) {
$('calc1_zuhe').style.display = 'block';
$("calc1_ctype").style.display = 'none';
fmobj.jisuan_radio[1].checked = true;
exc_js(fmobj, 2);
} else {
$('calc1_zuhe').style.display = 'none';
$("calc1_ctype").style.display = 'block';
}
fmobj.type.value = v;
if (v == 1) {
$('singlelv_li').style.display = 'block';
$('sdlv_li').style.display = 'none';
$('gjlv_li').style.display = 'none';
$('singlelv').value = $('sdlv').value;
} else if (v == 2) {
$('singlelv_li').style.display = 'block';
$('sdlv_li').style.display = 'none';
$('gjlv_li').style.display = 'none';
$('singlelv').value = $('gjlv').value;
} else if (v == 3) {
$('singlelv_li').style.display = 'none';
$('sdlv_li').style.display = 'block';
$('gjlv_li').style.display = 'block';
}
} else {
if (v == 3) {
$('calc2_zuhe').style.display = 'block';
fmobj.jisuan_radio[1].checked = true;
exc_js(fmobj, 2);
} else {
$('calc2_zuhe').style.display = 'none';
}
}
}

function exc_js(fmobj, v) {
//var fmobj=document.calc1;
if (fmobj.name == "calc1") {
if (v == 1) {
$('calc1_js_div1').style.display = 'block';
$('calc1_js_div2').style.display = 'none';
$('calc1_zuhe').style.display = 'none';
fmobj.type.value = 1;
} else {
$('calc1_js_div1').style.display = 'none';
$('calc1_js_div2').style.display = 'block';
}
} else {
if (v == 1) {
$('calc2_js_div1').style.display = 'block';
$('calc2_js_div2').style.display = 'none';
$('calc2_zuhe').style.display = 'none';
fmobj.type.value = 1;
} else {
$('calc2_js_div1').style.display = 'none';
$('calc2_js_div2').style.display = 'block';
}
}
}


//楠岃瘉鏄惁涓烘暟瀛�
function reg_Num(str) {
if (str.length == 0) { return false; }
var Letters = "1234567890.";

for (i = 0; i < str.length; i++) {
var CheckChar = str.charAt(i);
if (Letters.indexOf(CheckChar) == -1) { return false; }
}
return true;
}

//鏈噾杩樻鐨勬湀杩樻棰�(鍙傛暟: 骞村埄鐜� / 璐锋鎬婚 / 璐锋鎬绘湀浠� / 璐锋褰撳墠鏈�0锝瀕ength-1)
function getMonthMoney2(lilv, total, month, cur_month) {
var lilv_month = lilv / 12;//鏈堝埄鐜�
//return total * lilv_month * Math.pow(1 + lilv_month, month) / ( Math.pow(1 + lilv_month, month) -1 );
var benjin_money = total / month;
return (total - benjin_money * cur_month) * lilv_month + benjin_money;
}

//鏈伅杩樻鐨勬湀杩樻棰�(鍙傛暟: 骞村埄鐜�/璐锋鎬婚/璐锋鎬绘湀浠�)
function getMonthMoney1(lilv, total, month) {
var lilv_month = lilv / 12;//鏈堝埄鐜�
return total * lilv_month * Math.pow(1 + lilv_month, month) / (Math.pow(1 + lilv_month, month) - 1);
}

function exc_yj(fmobj) {
var jzfs = document.getElementById("jzfs").value.toString();
if (jzfs == "宸环") {
document.getElementById("chajia").style.display = '';
} else {
document.getElementById("chajia").style.display = 'none';
}

}

function exc_yxz(fmobj) {
var housexz = document.getElementById("housexz").value.toString();
if (housexz == "缁忔祹閫傜敤鎴�") {
document.getElementById("man5").style.display = 'none';
} else {
document.getElementById("man5").style.display = '';
}

}


function exc_sf(fmobj, v) {
if (fmobj.name == "calc1") {
if (v == 2) {

document.getElementById("esfhouse-res").style.display = "block";
document.getElementById("newhouse-res").style.display = "none";
document.getElementById("typeEsf").style.display = "";

//fmobj.reset();

} else {
document.getElementById("esfhouse-res").style.display = "none";
document.getElementById("newhouse-res").style.display = "block";
document.getElementById("typeEsf").style.display = "none";
//fmobj.reset();

}
}
}


function getreset(fmobj) {
fmobj = document.getElementById('calc1');
fmobj.reset();
exc_sf(fmobj, 2);
}


function sfzj(fmobj) {
var housedw = "涓囧厓"; //鎬讳环鍗曚綅
var mj = fmobj.housearea.value;
var djj = fmobj.dj.value;

//鎬讳环澶勭悊
if (housedw == "涓囧厓") {
fmobj.houseprice.value = mj * djj / 10000;
} else {

fmobj.houseprice.value = mj * djj;
}
}

function ext_total(fmobj) {
var houseprice = parseFloat(document.getElementById("houseprice").value.toString()); //鎴垮眿鎬讳环
var housedw = "涓囧厓"; //鎬讳环鍗曚綅
var houseyprice = parseFloat(document.getElementById("houseyprice").value.toString()); //鎴垮眿鍘熶环
var fwdj = parseFloat(document.getElementById("dj").value.toString()); //鎴垮眿鍗曚环
var houseypricedw = "涓囧厓"; //鍘熶环鍗曚綅
var housearea = parseFloat(document.getElementById("housearea").value.toString()); //鎴垮眿闈㈢Н
if (isNaN(housearea)) {
alert("鎴垮眿闈㈢Н蹇呴』鏈夋纭殑鍊硷紒");
document.getElementById("housearea").focus();
return;
}
if (isNaN(fwdj)) {
alert("鎴垮眿鍗曚环蹇呴』鏈夋纭殑鍊硷紒");
document.getElementById("dj").focus();
return;
}
var housexz = document.getElementById("housexz").value.toString(); //鎴垮眿鎬ц川
var strjzfs = document.getElementById("jzfs").value.toString(); //璁′环鏂瑰紡
var radiox = document.getElementsByName("radiox"); //鏄惁婊�5骞�
var radioQ = document.getElementsByName("radioQ"); //鏄惁棣栧浣忔埧
var only = document.getElementsByName("only"); //鏄惁鍞竴浣忔埧
var strRadiox; //鏄惁婊�2骞�
var strRadioq; //鏄惁棣栧浣忔埧
var strOnly; //鏄惁鍞竴浣忔埧
for (var i = 0; i < radiox.length; i++) {
if (radiox.item(i).checked) {
strRadiox = radiox.item(i).getAttribute("value");
break;
} else {
continue;
}
}
for (var i = 0; i < radioQ.length; i++) {
if (radioQ.item(i).checked) {
strRadioq = radioQ.item(i).getAttribute("value");
break;
} else {
continue;
}
}
for (var i = 0; i < only.length; i++) {
if (only.item(i).checked) {
strOnly = only.item(i).getAttribute("value");
break;
} else {
continue;
}
}
//鎬讳环澶勭悊
if (housedw == "涓囧厓") {
houseprice = houseprice * 10000
}
if (houseypricedw == "涓囧厓") {
houseyprice = houseyprice * 10000
}
var qishui = 0; //濂戠◣
var yyshu = 0; //钀ヤ笟绋�
var grsdshui = 0; //涓汉鎵€寰楃◣
var gbshui = 5; //宸ユ湰绋�
var yhshui = 0; //鍗拌姳绋�
var zhdijikuai = 0; //缁煎悎鍦颁环娆�
if (housexz == "鏅€氫綇瀹�") {
if (strRadioq == "鏄�") {
if (housearea < 90) {
qishui = houseprice * 1 / 100;
} else if (90 < housearea < 140 || housearea == 90) {
qishui = houseprice * 1.5 / 100;
} if (housearea > 140 || housearea == 140) {
qishui = houseprice * 3 / 100;
}
} else {
qishui = houseprice * 3 / 100;
}
if (strRadiox == "鏄�") {

if (housearea > 140 || housearea == 140) {
if (strjzfs == "鎬讳环") {
yyshui = houseprice * 56 / 1000;
} else {
yyshui = houseprice - houseyprice;
yyshui = yyshui * 56 / 1000;
}

} else {
yyshui = 0;
}
if (strOnly == "鏄�") {
grsdshui = 0;
} else {
if (strjzfs == "鎬讳环") {
grsdshui = houseprice * 1 / 100;
} else {
grsdshui = houseprice - houseyprice;
grsdshui = grsdshui * 20 / 100;
}

}
grsdshui = houseprice * 1 / 100;

} else {
if (strjzfs == "鎬讳环") {
grsdshui = houseprice * 1 / 100;
} else {
grsdshui = houseprice - houseyprice;
grsdshui = grsdshui * 20 / 100;
}
grsdshui = houseprice * 1 / 100;
yyshui = houseprice * 56 / 1000;
}

zhdijikuai = 0;
}
else if (housexz == "闈炴櫘閫氫綇瀹�") {
qishui = houseprice * 3 / 100;
if (strjzfs == "鎬讳环") {
yyshui = houseprice * 56 / 1000;
} else {
yyshui = houseprice - houseyprice;
yyshui = yyshui * 56 / 1000;
}
if (strRadiox == "鏄�" && strRadioq == "鏄�") {
if (strjzfs == "鎬讳环") {
grsdshui = houseprice * 1 / 100;
} else {

grsdshui = houseprice - houseyprice;
grsdshui = grsdshui * 20 / 100;
}
} else {

if (strjzfs == "鎬讳环") {
grsdshui = houseprice * 1 / 100;
} else {

grsdshui = houseprice - houseyprice;
grsdshui = grsdshui * 20 / 100;
}
}
grsdshui = houseprice * 1 / 100;
zhdijikuai = 0;
} else {
if (strRadioq == "鏄�") {
if (housearea < 90) {
qishui = houseprice * 1 / 100;
} else if (90 < housearea < 140 || housearea == 90) {
qishui = houseprice * 1.5 / 100;
} if (housearea > 140 || housearea == 140) {
qishui = houseprice * 3 / 100;
}
} else {
qishui = houseprice * 3 / 100;
}
zhdijikuai = houseprice * 10 / 100;
if (housearea > 140 || housearea == 140) {
yyshui = houseprice * 56 / 1000;
} else {
yyshui = 0;

}
yhshui = 0;
if (strOnly == "鏄�") {
grsdshui = 0;

} else {
if (strjzfs == "鎬讳环") {
grsdshui = houseprice * 1 / 100;
} else {
grsdshui = houseprice - houseyprice;
grsdshui = grsdshui * 20 / 100;
}
}
grsdshui = houseprice * 1 / 100;
gbshui = 5;
}
fmobj.qishui.value = qishui;
fmobj.yyshui.value = yyshui;
fmobj.yhshui.value = yhshui;
fmobj.grsdshui.value = grsdshui;
fmobj.gbshui.value = gbshui;
fmobj.zhdijikuai.value = zhdijikuai;
fmobj.heji.value = qishui + yyshui + yhshui + grsdshui + gbshui + zhdijikuai;

var dj33 = parseFloat(fwdj);
var mj33 = parseFloat(housearea);
var fkz3 = dj33 * mj33;
yh = fkz3 * 0.0005;
if (dj33 <= 9432) q1 = fkz3 * 0.015
else if (dj33 > 9432) q1 = fkz3 * 0.03
if (mj33 <= 120) fw1 = 500;
else if (120 < mj33 <= 5000) fw1 = 1500;
if (mj33 > 5000) fw1 = 5000
gzh = fkz3 * 0.003
fmobj.yh.value = Math.round(yh * 100, 5) / 100
fmobj.fkz3.value = Math.round(fkz3 * 100, 5) / 100
fmobj.q.value = Math.round(q1 * 100, 5) / 100
fmobj.gzh.value = Math.round(gzh * 100, 5) / 100
fmobj.wt.value = Math.round(gzh * 100, 5) / 100
fmobj.fw.value = Math.round(fw1 * 100, 5) / 100

}


function chanage_type_mm() {
if ($("dengeben2").checked)
$("type1_mm1").innerHTML = '&nbsp;&nbsp;鏈堝潎閲戦锛�<textarea name="month_money1" rows="5" ></textarea>';
else
$("type1_mm1").innerHTML = '&nbsp;&nbsp;鏈堝潎杩樻锛�<input name="month_money1" type="text" class="guestbook02" />鍏�';
}

//鎻愬墠杩樻瓈璁$畻
function play() {
if (document.tqhdjsq.dkzws.value == '') {
alert('璇峰~鍏ヨ捶娆炬€婚');
document.tqhdjsq.dkzws.focus();
return;

} else dkzys = parseFloat(document.tqhdjsq.dkzws.value) * 10000;
if (document.tqhdjsq.tqhkfs[1].checked && document.tqhdjsq.tqhkws.value == '') {
alert('璇峰~鍏ラ儴鍒嗘彁鍓嶈繕娆鹃搴�');
document.tqhdjsq.tqhkws.focus();
return;
}

s_yhkqs = parseInt(document.tqhdjsq.yhkqs.value);

//鏈堝埄鐜�
dklv = document.getElementById('txtrate').value / 100 / 12;

//宸茶繕璐锋鏈熸暟
yhdkqs = (parseInt(document.tqhdjsq.tqhksjn.value) * 12 + parseInt(document.tqhdjsq.tqhksjy.value)) - (parseInt(document.tqhdjsq.yhksjn.value) * 12 + parseInt(document.tqhdjsq.yhksjy.value));

if (yhdkqs < 0 || yhdkqs > s_yhkqs) {
alert('棰勮鎻愬墠杩樻鏃堕棿涓庣涓€娆¤繕娆炬椂闂存湁鐭涚浘锛岃鏌ュ疄');
return false;
}

yhk = dkzys * (dklv * Math.pow((1 + dklv), s_yhkqs)) / (Math.pow((1 + dklv), s_yhkqs) - 1);
yhkjssj = Math.floor((parseInt(document.tqhdjsq.yhksjn.value) * 12 + parseInt(document.tqhdjsq.yhksjy.value) + s_yhkqs - 2) / 12) + '骞�' + ((parseInt(document.tqhdjsq.yhksjn.value) * 12 + parseInt(document.tqhdjsq.yhksjy.value) + s_yhkqs - 2) % 12 + 1) + '鏈�';
yhdkys = yhk * yhdkqs;

yhlxs = 0;
yhbjs = 0;
for (i = 1; i <= yhdkqs; i++) {
yhlxs = yhlxs + (dkzys - yhbjs) * dklv;
yhbjs = yhbjs + yhk - (dkzys - yhbjs) * dklv;
}

remark = '';
if (document.tqhdjsq.tqhkfs[1].checked) {
tqhkys = parseInt(document.tqhdjsq.tqhkws.value) * 10000;
if (tqhkys + yhk >= (dkzys - yhbjs) * (1 + dklv)) {
remark = '鎮ㄧ殑鎻愬墠杩樻棰濆凡瓒冲杩樻竻鎵€娆犺捶娆撅紒';
} else {
yhbjs = yhbjs + yhk;
byhk = yhk + tqhkys;
if (document.tqhdjsq.clfs[0].checked) {
yhbjs_temp = yhbjs + tqhkys;
for (xdkqs = 0; yhbjs_temp <= dkzys; xdkqs++) yhbjs_temp = yhbjs_temp + yhk - (dkzys - yhbjs_temp) * dklv;
xdkqs = xdkqs - 1;
xyhk = (dkzys - yhbjs - tqhkys) * (dklv * Math.pow((1 + dklv), xdkqs)) / (Math.pow((1 + dklv), xdkqs) - 1);
jslx = yhk * s_yhkqs - yhdkys - byhk - xyhk * xdkqs;
xdkjssj = Math.floor((parseInt(document.tqhdjsq.tqhksjn.value) * 12 + parseInt(document.tqhdjsq.tqhksjy.value) + xdkqs - 2) / 12) + '骞�' + ((parseInt(document.tqhdjsq.tqhksjn.value) * 12 + parseInt(document.tqhdjsq.tqhksjy.value) + xdkqs - 2) % 12 + 1) + '鏈�';
} else {
xyhk = (dkzys - yhbjs - tqhkys) * (dklv * Math.pow((1 + dklv), (s_yhkqs - yhdkqs))) / (Math.pow((1 + dklv), (s_yhkqs - yhdkqs)) - 1);
jslx = yhk * s_yhkqs - yhdkys - byhk - xyhk * (s_yhkqs - yhdkqs);
xdkjssj = yhkjssj;
}
}
}

if (document.tqhdjsq.tqhkfs[0].checked || remark != '') {
byhk = (dkzys - yhbjs) * (1 + dklv);
xyhk = 0;
jslx = yhk * s_yhkqs - yhdkys - byhk;
xdkjssj = document.tqhdjsq.tqhksjn.value + '骞�' + document.tqhdjsq.tqhksjy.value + '鏈�';
}
document.tqhdjsq.ykhke.value = Math.round(yhk * 100) / 100;
document.tqhdjsq.yhkze.value = Math.round(yhdkys * 100) / 100;
document.tqhdjsq.yhlxe.value = Math.round(yhlxs * 100) / 100;
document.tqhdjsq.gyyihke.value = Math.round(byhk * 100) / 100;
document.tqhdjsq.xyqyhke.value = Math.round(xyhk * 100) / 100;
document.tqhdjsq.jslxzc.value = Math.round(jslx * 100) / 100;
document.tqhdjsq.yzhhkq.value = yhkjssj;
document.tqhdjsq.xdzhhkq.value = xdkjssj;
document.tqhdjsq.jsjgts.value = remark;
}


function runjs3(obj) {
dj3 = parseFloat(obj.dj3.value);
mj3 = parseFloat(obj.mj3.value);
fkz3 = dj3 * mj3;
yh = fkz3 * 0.0005;
if (dj3 <= 9432) q = fkz3 * 0.015;
else if (dj3 > 9432) q = fkz3 * 0.03;
if (mj3 <= 120) fw = 500;
else if (120 < mj3 <= 5000) fw = 1500;
if (mj3 > 5000) fw = 5000;
gzh = fkz3 * 0.003;
obj.yh.value = Math.round(yh * 100, 5) / 100;
obj.fkz3.value = Math.round(fkz3 * 100, 5) / 100;
obj.q.value = Math.round(q * 100, 5) / 100;
obj.gzh.value = Math.round(gzh * 100, 5) / 100;
obj.wt.value = Math.round(gzh * 100, 5) / 100;
obj.fw.value = Math.round(fw * 100, 5) / 100;
}

//涓汉鍏Н閲�
var l1_5 = 0.0405;
var l6_30 = 0.0459;

function isIdCardNo(sNo) {
sNo = sNo.toString();
if (sNo.length == 18) {
var a, b, c;
if (!isInt(sNo.substr(0, 17))) { return false; }

a = parseInt(sNo.substr(0, 1)) * 7 + parseInt(sNo.substr(1, 1)) * 9 + parseInt(sNo.substr(2, 1)) * 10;
a = a + parseInt(sNo.substr(3, 1)) * 5 + parseInt(sNo.substr(4, 1)) * 8 + parseInt(sNo.substr(5, 1)) * 4;
a = a + parseInt(sNo.substr(6, 1)) * 2 + parseInt(sNo.substr(7, 1)) * 1 + parseInt(sNo.substr(8, 1)) * 6;
a = a + parseInt(sNo.substr(9, 1)) * 3 + parseInt(sNo.substr(10, 1)) * 7 + parseInt(sNo.substr(11, 1)) * 9;
a = a + parseInt(sNo.substr(12, 1)) * 10 + parseInt(sNo.substr(13, 1)) * 5 + parseInt(sNo.substr(14, 1)) * 8;
a = a + parseInt(sNo.substr(15, 1)) * 4 + parseInt(sNo.substr(16, 1)) * 2;
b = a % 11;

if (b == 2) {
c = sNo.substr(17, 1);
//c = sNo.substr(17, 1).toUpperCase();
} else {
c = parseInt(sNo.substr(17, 1));
}

switch (b) {
case 0: if (c != 1) { return false; } break;
case 1: if (c != 0) { return false; } break;
case 2: if (c != "X") { return false; } break;
case 3: if (c != 9) { return false; } break;
case 4: if (c != 8) { return false; } break;
case 5: if (c != 7) { return false; } break;
case 6: if (c != 6) { return false; } break;
case 7: if (c != 5) { return false; } break;
case 8: if (c != 4) { return false; } break;
case 9: if (c != 3) { return false; } break;
case 10: if (c != 2) { return false; }
}
} else {
if (!isInt(sNo)) { return false; }
}

switch (sNo.length) {
case 15: if (isValidDate(sNo.substr(6, 2), sNo.substr(8, 2), sNo.substr(10, 2))) { return true; }
case 18: if (isValidDate(sNo.substr(6, 4), sNo.substr(10, 2), sNo.substr(12, 2))) { return true; }
}
return false;
}

function isValidDate(iY, iM, iD) {
var undefined;
if (iY != undefined && !isNaN(iY) && iY >= 0 && iY <= 9999 && iM != undefined && !isNaN(iM) && iM >= 1 && iM <= 12 && iD != undefined && !isNaN(iD) && iD >= 1 && iD <= 31) {
if (iY < 50) iY = 2000 + iY;
else if (iY < 100) iY = 1900 + iY;
if (iM == 2 && (isLeapYear(iY) && iD > 29 || !isLeapYear(iY) && iD > 28) || iD == 31 && (iM < 7 && iM % 2 == 0 || iM > 7 && iM % 2 == 1))
return false;
else return true;
} else
return false;
}

function isLeapYear(year) {
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
return true;
}
return false;
}

function isEmpty(str) {
if ((str == null) || (str.length == 0)) return true;
else return (false);
}

function isInt(theStr) {
var flag = true;

if (isEmpty(theStr)) { flag = false; }
else {
for (var i = 0; i < theStr.length; i++) {
if (theStr.substring(i, i + 1) == ".") {
flag = false;
break;
}
}
}
return (flag);
}

function isnumeric(p) {
if (p == "")
return false;
var l = p.length;
var count = 0;
for (var i = 0; i < l; i++) {
var digit = p.charAt(i);
if (digit == ".") {
++count;
if (count > 1) return false;
}
else if (digit < "0" || digit > "9")
return false;
}
return true;
}
function Format(num, dotLen) {

var dot = 0
var num1 = 0
//change by liyugen
if (typeof dotLen == "undefined")
dot = 2
else
dot = dotLen
if (isNaN(parseFloat(num)))
return 0
else
num1 = parseFloat(num)
var n1 = Math.pow(10, dot)
if (n1 == 0)
var iValue = Math.round(num1)
else
var iValue = Math.round(num1 * n1) / n1
var sValue = iValue.toString();
if (sValue.indexOf(".") == -1) {
sValue = sValue + ".00";
}
else {
if (sValue.indexOf(".") == sValue.length - 1) {
sValue = sValue + "00";
}
else if (sValue.indexOf(".") == sValue.length - 2) {
sValue = sValue + "0";
}
}
return sValue
}
function c_id_card(obj) {
var id_card = obj.id_card.value;//韬唤璇�
var age = 0;
age_qx.innerText = '';
if (id_card.length > 0) {
if (!isInt(id_card)) { alert('韬唤璇佸彿鐮佸繀椤绘槸鏁板瓧'); return false; }
if (id_card.length != 15 && id_card.length != 18) { alert('韬唤璇佸彿鐮侀暱搴︿负15鎴�18浣�'); return false; }
if (!isIdCardNo(id_card)) { alert('璇疯緭鍏ユ纭殑韬唤璇佸彿鐮�'); return false; }
var a = new Date();
var y = Number(a.getFullYear());
if (id_card.length == 15) { age = y - Number('19' + id_card.substr(6, 2)); } else { age = y - Number(id_card.substr(6, 4)); }
var max_qx = 70 - age; if (max_qx > 30) { max_qx = 30; }
age_qx.innerText = '鏈€闀胯捶娆�' + max_qx + '骞�';
}
}
function gjjloan1(obj) {
var gryjce;//浣忔埧鍏Н閲戜釜浜烘湀缂村瓨棰�
var poyjce;//閰嶅伓浣忔埧鍏Н閲戜釜浜烘湀缂村瓨棰�
var grjcbl;//缂村瓨姣斾緥
var pojcbl;//閰嶅伓缂村瓨姣斾緥
var xy;//涓汉淇$敤
var fwzj;//鎴垮眿鎬讳环
var fwxz;//鎴垮眿鎬ц川
var dknx;//璐锋鐢宠骞撮檺
var syhk;//棣栨湀杩樻棰�

var dked;//闇€瑕佽捶娆鹃搴�
var hkfs;//杩樻鏂瑰紡
var bxhj;//鏈伅鍚堣
var bxhj2;//鏈伅鍚堣绛夋湰閲�

//涓棿鍙橀噺
var gbl;
var jtysr;//瀹跺涵鏈堟敹鍏�
var r;//鏈堣繕娆�
var gjjdka;//浣忔埧鍏Н閲戣捶娆鹃搴
var gjjdkb;//浣忔埧鍏Н閲戣捶娆鹃搴
var gjjdkc;//浣忔埧鍏Н閲戣捶娆鹃搴

gryjce = obj.mount2.value;
if (gryjce <= 0) {
alert('浣忔埧鍏Н閲戜釜浜烘湀缂村瓨棰濅笉鑳戒负绌�,璇疯緭鍏�');
obj.mount2.value = ''; obj.mount2.focus(); return;
}

poyjce = obj.mount3.value;
if (poyjce.length > 0 && !isnumeric(poyjce))
{ alert("閰嶅伓鏈堢即瀛橀褰曞叆涓嶆纭�"); return; }

if (obj.jcbl.value == "" || !isInt(obj.jcbl.value) || Number(obj.jcbl.value) <= 0 || Number(obj.jcbl.value) >= 100) {
alert("缂村瓨姣斾緥涓嶆纭�"); return;
}
if (poyjce.length > 0 && (obj.p_bl.value == "" || !isInt(obj.p_bl.value) || Number(obj.p_bl.value) <= 0 || Number(obj.p_bl.value) >= 100)) {
alert("閰嶅伓缂村瓨姣斾緥涓嶆纭�"); return;
}
grjcbl = obj.jcbl.value / 100;
pojcbl = obj.p_bl.value / 100;
/*
if (obj.xz[0].checked==true){fwxz=0.9;}
else {fwxz=0.95;}
*/
if (obj.xz[0].checked == true) { fwxz = 0.9; }
else { fwxz = 0.8; }

if (obj.xy[0].checked == true) { xy = 1.3; }
else if (obj.xy[1].checked == true) { xy = 1.15; }
else { xy = 1; }

fwzj = obj.mount.value;

if (fwzj <= 0) {
alert('锛傛埧灞嬭瘎浼颁环鍊兼垨瀹為檯璐埧娆撅紓涓嶈兘涓虹┖,璇疯緭鍏�');
obj.mount.focus();
obj.mount.value = ''; return;
}

dknx = Math.round(obj.mount10.value);

if (dknx <= 0) {
alert('璐锋鐢宠骞撮檺涓嶈兘涓虹┖,璇疯緭鍏�');
obj.mount10.value = ''; return;
}
if (dknx > 30) {
alert('璐锋鐢宠骞撮檺涓嶈兘澶т簬30骞�,璇烽噸鏂拌緭鍏�');
obj.mount10.value = ''; return;
}
var bcv = 0;
if (dknx > 5) {
bcv = Math.round(1000000 * l6_30 / 12) / 1000000;
} else {
bcv = Math.round(1000000 * l1_5 / 12) / 1000000;
}
r = adv_format((10000 * bcv * Math.pow(1 + bcv, 12 * dknx)) / (Math.pow(1 + bcv, 12 * dknx) - 1), 2);


if (poyjce.length > 0) {
jtysr = Math.ceil((gryjce / grjcbl + poyjce / pojcbl) * 10) / 10;
}
else {
jtysr = Math.ceil((gryjce / grjcbl) * 10) / 10;
}
if (jtysr <= 400) {
alert('瀹跺涵鏈堟敹鍏ヤ綆浜�400锛屼笉绗﹀悎璐锋鏉′欢');
return;
}

gjjdka = Math.min(Math.round((jtysr - 400) / r * 10000 * 10) / 10, 800000);
gjjdkb = Math.round(gjjdka * xy * 10) / 10;
gjjdkc = Math.round(fwzj * fwxz * 10) / 10;
//obj.ze2.value=gjjdka; //jtysr;
obj.ze2.value = Math.floor(Math.min(gjjdkb, gjjdkc) / 10000 * 10) / 10;
zgdk = obj.ze2.value; //鏈€楂樿捶娆鹃搴�













//璁$畻鐢宠鐨勬渶楂樿捶娆鹃搴�

/*
璇存槑
瀹跺涵鏈堟敹鍏ワ紳浣忔埧鍏Н閲戜釜浜烘湀缂村瓨棰澝风即瀛樻瘮渚�+閰嶅伓浣忔埧鍏Н閲戜釜浜烘湀缂村瓨棰澝风即瀛樻瘮渚�

浣忔埧鍏Н閲戣捶娆鹃搴锛濓紙瀹跺涵鏈堟敹鍏ワ紞400锛壝风瓑棰濆潎杩樻湀杩樻棰濇瘡涓囧厓鏈堣繕娆鹃锛屼笖涓嶅ぇ浜�40涓囧厓

瀵逛簬涓汉淇$敤绛夌骇涓篈AA鐨勶紝浣忔埧鍏Н閲戣捶娆鹃搴锛濅綇鎴垮叕绉噾璐锋棰濆害a脳130锛�

瀵逛簬涓汉淇$敤绛夌骇涓篈A鐨勶紝浣忔埧鍏Н閲戣捶娆鹃搴锛濅綇鎴垮叕绉噾璐锋棰濆害a脳115锛�

瀵逛簬涓汉淇$敤绛夌骇鍏跺畠鐨勶紝浣忔埧鍏Н閲戣捶娆鹃搴锛濅綇鎴垮叕绉噾璐锋棰濆害a

瀵规埧灞嬫€ц川涓哄晢鍝佹埧鏈熸埧鐨勶紝浣忔埧鍏Н閲戣捶娆鹃搴锛濇埧灞嬫€讳环脳90锛�

瀵规埧灞嬫€ц川涓哄叾瀹冪殑锛屼綇鎴垮叕绉噾璐锋棰濆害c锛濇埧灞嬫€讳环脳95锛�

鏈€楂樿捶娆鹃搴锛漨in锛坆锛宑锛�

绛夐鍧囪繕杩樻鍏紡锛�


绛夐鏈噾杩樻鍏紡

棣栨湀杩樻棰�=P/锛坣脳12锛�+鍊熸鎬婚脳I

鍏朵腑锛歅涓鸿捶娆炬湰閲戯紝I涓烘湀鍒╃巼锛宯涓鸿捶娆惧勾闄愩€�


*/
}
function adv_format(value, num) //鍥涜垗浜斿叆
{
var a_str = formatnumber(value, num);
var a_int = parseFloat(a_str);
if (value.toString().length > a_str.length) {
var b_str = value.toString().substring(a_str.length, a_str.length + 1)
var b_int = parseFloat(b_str);
if (b_int < 5) {
return a_str
}
else {
var bonus_str, bonus_int;
if (num == 0) {
bonus_int = 1;
}
else {
bonus_str = "0."
for (var i = 1; i < num; i++)
bonus_str += "0";
bonus_str += "1";
bonus_int = parseFloat(bonus_str);
}
a_str = formatnumber(a_int + bonus_int, num)
}
}
return a_str
}
function formatnumber(value, num) //鐩存帴鍘诲熬
{
var a, b, c, i
a = value.toString();
b = a.indexOf('.');
c = a.length;
if (num == 0) {
if (b != -1)
a = a.substring(0, b);
}
else {
if (b == -1) {
a = a + ".";
for (i = 1; i <= num; i++)
a = a + "0";
}
else {
a = a.substring(0, b + num + 1);
for (i = c; i <= b + num; i++)
a = a + "0";
}
}
return a
}
function gjjloan2(obj) {

var gryjce;//浣忔埧鍏Н閲戜釜浜烘湀缂村瓨棰�
var poyjce;//閰嶅伓浣忔埧鍏Н閲戜釜浜烘湀缂村瓨棰�
var grjcbl;//缂村瓨姣斾緥
var pojcbl;//閰嶅伓缂村瓨姣斾緥
var xy; //涓汉淇$敤
var fwzj;//鎴垮眿鎬讳环
var fwxz;//鎴垮眿鎬ц川
var dknx;//璐锋鐢宠骞撮檺
var syhk; //棣栨湀杩樻棰�

var dked;//闇€瑕佽捶娆鹃搴�
var hkfs;//杩樻鏂瑰紡
var bxhj; //鏈伅鍚堣
var bxhj2; //鏈伅鍚堣绛夋湰閲�

//涓棿鍙橀噺
var gbl;
var jtysr; //瀹跺涵鏈堟敹鍏�
var r;//鏈堣繕娆�
var rb;
var gjjdka;//浣忔埧鍏Н閲戣捶娆鹃搴
var gjjdkb;//浣忔埧鍏Н閲戣捶娆鹃搴
var gjjdkc;//浣忔埧鍏Н閲戣捶娆鹃搴


gryjce = obj.mount2.value;
if (gryjce <= 0) {
alert('浣忔埧鍏Н閲戜釜浜烘湀缂村瓨棰濅笉鑳戒负绌�,璇疯緭鍏�.');
obj.mount2.value = '';
obj.mount.focus();
return;
}

poyjce = obj.mount3.value;
/*if (obj.jcbl[0].checked==true)
{grjcbl=0.08;}
else {grjcbl=0.1;}

if (obj.p_bl[0].checked==true){pojcbl=0.08;}
else {pojcbl=0.1;}
*/
grjcbl = obj.jcbl.value / 100;
pojcbl = obj.p_bl.value / 100;
if (obj.xz[0].checked == true) { fwxz = 0.9; }
else { fwxz = 0.8; }

if (obj.xy[0].checked == true) { xy = 1.15; }
else if (obj.xy[1].checked == true) { xy = 1.3; }
else { xy = 1; }



fwzj = obj.mount.value;

if (fwzj <= 0) {
alert('鎴垮眿鎬讳环涓嶈兘涓虹┖,璇疯緭鍏�');
obj.mount.value = ''; return;
}

dknx = Math.round(obj.mount10.value);
//alert(dknx);
if (dknx <= 0) {
alert('璐锋鐢宠骞撮檺涓嶈兘涓虹┖,璇疯緭鍏�');
obj.mount10.value = ''; return;
}





var bcv = 0;
if (dknx > 5) {
bcv = Math.round(1000000 * l6_30 / 12) / 1000000;
} else {
bcv = Math.round(1000000 * l1_5 / 12) / 1000000;
}
r = adv_format((10000 * bcv * Math.pow(1 + bcv, 12 * dknx)) / (Math.pow(1 + bcv, 12 * dknx) - 1), 2);

jtysr = Math.ceil((gryjce / grjcbl + poyjce / pojcbl) * 10) / 10;
gjjdka = Math.min(Math.round((jtysr - 400) / r * 10000 * 10) / 10, 800000);
gjjdkb = Math.round(gjjdka * xy * 10) / 10;
gjjdkc = Math.round(fwzj * fwxz * 10) / 10;
//obj.ze2.value=gjjdka; //jtysr;
//obj.ze2.value=Math.floor(Math.min(gjjdkb,gjjdkc)/10000*10)/10;

//璁$畻2
zgdk = obj.ze2.value; //鏈€楂樿捶娆鹃搴�

dked = Math.round(obj.need.value * 10) / 10;

obj.need.value = dked;

if (dked == 0) {
alert('闇€瑕佺殑璐锋棰濆害涓嶈兘涓虹┖,璇疯緭鍏�');
obj.need.value = ''; return;
}
if (dked < 0) {
alert('杈撳叆鐨勮捶娆鹃搴︿笉绗﹀悎瑕佹眰,璇疯緭鍏�');
obj.need.value = ''; return;
}


if (dked > zgdk) {
alert('涓嶈兘楂樹簬鏈€楂樿捶娆鹃搴�,璇烽噸鏂拌緭鍏�');
obj.need.value = ''; return;
}


hkfs = obj.select.value;

if (hkfs == 1) {
//obj.ze22.value=Math.ceil(dked*r*100)/100;
//==============================modify by xujianfei
var ylv_new;

if (dknx >= 1 && dknx <= 5)
ylv_new = l1_5 / 12;
else
ylv_new = l6_30 / 12;


var ncm = parseFloat(ylv_new) + 1;//n娆″箓

var dknx_new = dknx * 12;



total_ncm = Math.pow(ncm, dknx_new)

obj.ze22.value = Math.round(((dked * 10000 * ylv_new * total_ncm) / (total_ncm - 1)) * 100) / 100;
var pp = Math.round(((dked * 10000 * ylv_new * total_ncm) / (total_ncm - 1)) * 100) / 100;

//=========================================================
gbl = Math.round(Math.ceil(dked * r * 100) / 100 / jtysr * 1000) / 10;
obj.yj2.value = gbl;
//bxhj=Math.round(r*dked*dknx*12*100)/100;
bxhj = Math.round(pp * dknx * 12 * 100) / 100;
obj.lx2.value = bxhj;
}
if (hkfs == 2) {
if (dknx > 5) {
rb = l6_30 * 100;
} else {
rb = l1_5 * 100;
}

syhk = Math.round((dked * 10000 / (dknx * 12) + dked * 10000 * rb / (100 * 12)) * 100) / 100;
obj.sfk2.value = syhk;
var yhke; //鏈堣繕娆鹃
var bxhj; //鏈伅鍚堣
var dkys; //璐锋鏈堟暟
var sydkze;//褰撳墠鍓╀綑璐锋鎬婚
var yhkbj; //鏈堣繕娆炬湰閲�
dkys = dknx * 12;
yhkbj = dked * 10000 / dkys;

yhke = syhk;
sydkze = dked * 10000 - yhkbj;
bxhj = syhk;
for (var count = 2; count <= dkys; ++count) {
//yhke=Math.round((dked*10000/(dknx*12)+sydkze*rb/(100*12))*100)/100;
yhke = dked * 10000 / dkys + sydkze * rb / 1200;
sydkze -= yhkbj;
bxhj += yhke;
}
obj.lx3.value = Math.round(bxhj * 100) / 100;
}

if (hkfs == 3) {

switch (dknx) {//鑷敱杩樻杩樻鏂瑰紡鏈堟渶浣庤繕娆鹃鍙傜収琛�,璋冩暣鍒╃巼涓嶄慨鏀�
case 1: rb = 83.04 / 100; break;
case 2: rb = 81.08 / 100; break;
case 3: rb = 79.12 / 100; break;
case 4: rb = 77.16 / 100; break;
case 5: rb = 75.20 / 100; break;
case 6: rb = 73.24 / 100; break;
case 7: rb = 71.28 / 100; break;
case 8: rb = 69.32 / 100; break;
case 9: rb = 67.36 / 100; break;
case 10: rb = 65.40 / 100; break;
case 11: rb = 63.44 / 100; break;
case 12: rb = 61.48 / 100; break;
case 13: rb = 59.52 / 100; break;
case 14: rb = 57.56 / 100; break;
case 15: rb = 55.60 / 100; break;
case 16: rb = 53.64 / 100; break;
case 17: rb = 51.68 / 100; break;
case 18: rb = 49.72 / 100; break;
case 19: rb = 47.76 / 100; break;
case 20: rb = 45.80 / 100; break;
case 21: rb = 43.84 / 100; break;
case 22: rb = 41.88 / 100; break;
case 23: rb = 39.92 / 100; break;
case 24: rb = 37.96 / 100; break;
case 25: rb = 36.00 / 100; break;
case 26: rb = 34.04 / 100; break;
case 27: rb = 32.08 / 100; break;
case 28: rb = 30.12 / 100; break;
case 29: rb = 28.16 / 100; break;
case 30: rb = 26.20 / 100; break;
}
var yhke; //鏈堣繕娆鹃
var ll;//鍒╃巼
var zhbj;//鏈€鍚庝竴鏈熸湰閲�
zhbj = Math.round(dked * 10000 * rb * 100) / 100;
if (dknx <= 5) {
ll = l1_5 / 12;
zdhkll = 0.0378 / 12;
var total_gjj = Math.pow(zdhkll + 1, dknx * 12);
syhk = Math.ceil(dked * 10000 * zdhkll * total_gjj / (total_gjj - 1));
}
else {
ll = l6_30 / 12;
zdhkll = 0.0423 / 12;
var total_gjj = Math.pow(zdhkll + 1, dknx * 12 - 1);
syhk = Math.ceil((dked * 10000 - zhbj) * zdhkll * total_gjj / (total_gjj - 1) + zhbj * zdhkll);
}
obj.sfk3.value = syhk; //鏈€浣庤繕娆鹃
var zhyqbj = dked * 10000;
var zchlx = 0;//鎬诲伩杩樺埄鎭�
for (i = 1; i < dknx * 12 ; i++) {
zchlx += Math.round(zhyqbj * ll * 100) / 100;
zhyqbj = Math.round((zhyqbj - (syhk - Math.round(zhyqbj * ll * 100) / 100)) * 100) / 100;
}
var sydkze = dked * 10000 - syhk;
obj.lx4.value = zhyqbj; //鏈€鍚庢湡鏈噾
obj.lx5.value = Math.round(zhyqbj * ll * 100) / 100;
/*for (i=1;i<dknx*12 ;i++ )
{
zchlx+=Math.round((dked*10000-(syhk-Math.round(dked*10000*ll*100)/100))*ll*100)/100;
}*/
zchlx += Math.round(zhyqbj * ll * 100) / 100;
obj.lx6.value = Math.round(zchlx * 100) / 100;
}



}
function gjjloan3(obj) {
var dkye = 0;//鎵€闇€瑕佸伩杩樼殑浣欓
var dkzqs = 0;//璐锋鎬绘湡鏁�
var gdhke = 0;//鍥哄畾杩樻棰�
var sxhke = 0;//鎵€闇€杩樻棰�
var sxhky = 0; //鎵€闇€瑕佺殑杩樻鏈堟暟
var zhhke = 0;//鏈€鍚庤繕娆鹃
var zglx = 0;//鎬诲叡鍒╂伅
var dylx = 0; //褰撴湀鍒╂伅
var syqs = 0;
syqs = Number(obj.lx8_sy.value);
dkye = Number(obj.lx7.value);
if (dkye <= 0 || dkye > 780000 || isNaN(dkye)) {
alert("璐锋浣欓杈撳叆涓嶆纭�");
return;
}
var ll; //鏈堝埄鐜�
if (obj.lx8[1].checked)
{ ll = Math.round(1000000 * l6_30 / 12) / 1000000; }
else
{ ll = Math.round(1000000 * l1_5 / 12) / 1000000; }
/*if(dkzqs<=0 || dkzqs>360 || isNaN(dkzqs))
{
alert("璐锋鎬绘湡鏁颁笉姝g‘!");
return;
}*/

gdhke = Number(obj.lx9.value);
if (Number(syqs) <= 0 || isNaN(syqs)) {
alert("璇疯緭鍏ユ纭殑鍓╀簬鏈熸暟!");
return;
}
if (Number(gdhke) <= 0 || isNaN(gdhke)) {
alert("璇疯緭鍏ユ纭殑鍥哄畾杩樻棰�!");
return;
}

var first_lx = Math.round(dkye * ll * 100) / 100;
if (first_lx > gdhke)
{ alert('鍥哄畾杩樻棰濆繀椤诲ぇ浜庨鏈堝埄鎭� ' + first_lx); obj.lx9.focus(); obj.lx9.select(); return; }
var yjqs = 0;//Math.ceil(dkye/gdhke);
var sxhky = 0;
for (var i = 1; i < syqs; i++) {
//闇€瑕佽繕娆炬湀+1
sxhky = sxhky + 1;
//璁$畻涓€涓湀鐨勫埄鎭�
dylx = Math.round(dkye * ll * 100) / 100;
//绱鍒╂伅
zglx = zglx + dylx;
//Math.round ((zglx + dylx) *100) /100 ;

if (dkye + dylx >= gdhke) {
if (dkye + dylx == gdhke) zhhke = dkye + dylx;
dkye = Math.round((dkye - (gdhke - dylx)) * 100) / 100;
//Math.round( (dkye - ( gdhke - dylx ))*100 ) /100;
}
else {
zhhke = dkye + dylx;
dkye = -1;
break;
}

}
if (dkye > 0) {
sxhky = sxhky + 1;
dylx = Math.round(dkye * ll * 100) / 100;
zglx = zglx + dylx;
zhhke = dkye + dylx
}


if (sxhky > syqs) {
alert("杈撳叆涓嶆纭�,璇烽噸鏂版牳瀵硅捶娆句綑棰濆拰鏈堝浐瀹氳繕娆鹃!" + sxhky);
return;
}



obj.lx10.value = sxhky;
obj.lx11.value = Format(zhhke, 2);
obj.lx12.value = Format(zglx, 2);
//濡傛灉鍓╀綑鏈噾+鍒╂伅< 鍥哄畾杩樻棰濆害 ==> 杩樻缁撴潫 ->鏈€鍚庢湡杩樻棰�
}

//璐埧鑳藉姏璇勪及
rhb = new Array(440.104, 301.103, 231.7, 190.136, 163.753, 144.08, 129.379, 117.991, 108.923, 101.542, 95.425, 90.282, 85.902, 82.133, 78.861, 75.997, 73.473, 71.236, 69.241, 67.455, 65.848, 64.397, 63.082, 61.887, 60.798, 59.802, 58.890, 58.052, 57.282)
yhz = new Array(1.978, 2.9344, 3.8699, 4.7847, 5.6794, 6.5544, 7.4102, 8.2472, 9.0657, 9.8662, 10.6491, 11.4148, 12.1636, 12.8959, 13.6121, 14.3126, 14.9977, 15.6677, 16.3229, 16.9637, 17.5904, 18.2034, 18.8028, 19.389, 19.9624, 20.5231, 21.0715, 21.6078, 22.1323)
function chk01() {
if (parseFloat(document.myform.rg01.value) < 4.7)
alert("--鎮ㄧ‘瀹氭槸" + parseFloat(document.myform.rg01.value) + "涓囧厓?--" + "\n\n" + "閭d箞鎮ㄧ洰鍓嶅皻涓嶅叿澶囪喘鎴胯兘鍔涳紝" + "\n\n" + "寤鸿绉敀绉搫鎴栬兘绛归泦鏇村鐨勮祫閲戙€�")
if (parseFloat(document.myform.rg01.value) > 10000)
alert("鎮ㄧ‘瀹氭嫢鏈夎秴杩囦竴浜垮厓鐨勮喘鎴胯祫閲戯紵");

}
function chk02() {
if (parseFloat(document.myform.rg03.value) > parseFloat(document.myform.rg02.value) * 0.7) {
alert("鎮ㄩ璁″搴瘡鏈堝彲鐢ㄤ簬璐埧鏀嚭宸茶秴杩囧搴湀鏀跺叆鐨�70%锛�" + "\n\n" + "鏄惁纭畾涓嶄細褰卞搷鎮ㄧ殑姝e父鐢熸椿娑堣垂锛�" + "\n\n" + "寤鸿鍦�40%锛�" + parseFloat(document.myform.rg02.value) * 0.4 + "鍏冿級宸﹀彸")
}
}
function chk03() {
if (document.myform.rg01.value == "") {
alert("璇峰~鍐欑幇鍙敤浜庤喘鎴跨殑璧勯噾");
document.myform.rg01.focus();
}
else {
if (document.myform.rg02.value == "") {
alert("璇峰~鍐欑幇瀹跺涵鏈堟敹鍏�");
document.myform.rg02.focus();
}
else {
if (document.myform.rg03.value == "") {
alert("璇峰~鍐欓璁″搴瘡鏈堝彲鐢ㄤ簬璐埧鏀嚭");
document.myform.rg03.focus();
}
else
if (document.myform.rg06.value == "") {
alert("璇峰~鍐欐偍璁″垝璐拱鎴垮眿鐨勯潰绉�");
document.myform.rg06.focus();
}
else {
chk04();
}
}
}
}
function chk03_coop() {
if (document.myform.rg01.value == "")
alert("璇峰~鍐欑幇鍙敤浜庤喘鎴跨殑璧勯噾")
else
if (document.myform.rg02.value == "")
alert("璇峰~鍐欑幇瀹跺涵鏈堟敹鍏�")
else
if (document.myform.rg03.value == "")
alert("璇峰~鍐欓璁″搴瘡鏈堝彲鐢ㄤ簬璐埧鏀嚭")
else
if (document.myform.rg06.value == "")
alert("璇峰~鍐欐偍璁″垝璐拱鎴垮眿鐨勯潰绉�")
else
chk04_coop()

}
function chk04_coop() {
//鎮ㄥ彲璐拱鐨勬埧灞嬫€讳环=锛堝搴湀鏀跺叆-瀹跺涵鏈堝浐瀹氭敮鍑猴級脳( (锛�1锛嬫湀鍒╃巼锛夛季杩樻鏈堟暟)锛�1 )梅锛绘湀鍒╃巼脳锛�1锛嬫湀鍒╃巼锛夛季杩樻鏈堟暟锛�+鎸佹湁璧勯噾
var month = parseInt(document.myform.rg04.options[document.myform.rg04.selectedIndex].value);
var year = parseInt(month / 12);
var lilu = 0.00576;
if (year > 5)
lilu = 0.00594;
js00 = parseFloat(document.myform.rg01.value);//鐜版寔鏈�
js01 = parseFloat(document.myform.rg02.value);//鏈堟敹鍏�
js02 = parseFloat(document.myform.rg03.value);//鏈堟敮鍑�
js03 = parseFloat(document.myform.rg06.value);//闈㈢Н

var d1 = js01 - js02;
var d2 = Math.pow(1 + lilu, month) - 1;
var d3 = lilu * Math.pow(1 + lilu, month)

document.myform.rg07.value = Math.round(((d1 * d2) / d3) + js00);
document.myform.rg08.value = parseFloat(document.myform.rg07.value) / js03;
pl_coop();
}
function chk04() {
//鎮ㄥ彲璐拱鐨勬埧灞嬫€讳环=锛堝搴湀鏀跺叆-瀹跺涵鏈堝浐瀹氭敮鍑猴級脳( (锛�1锛嬫湀鍒╃巼锛夛季杩樻鏈堟暟)锛�1 )梅锛绘湀鍒╃巼脳锛�1锛嬫湀鍒╃巼锛夛季杩樻鏈堟暟锛�+鎸佹湁璧勯噾
var month = parseInt(document.myform.rg04.options[document.myform.rg04.selectedIndex].value);
var year = parseInt(month / 12);
var lilu = 0.00576;
if (year > 5)
lilu = 0.00594;
js00 = parseFloat(document.myform.rg01.value);//鐜版寔鏈�
js01 = parseFloat(document.myform.rg02.value);//鏈堟敹鍏�
js02 = parseFloat(document.myform.rg03.value);//鏈堟敮鍑�
js03 = parseFloat(document.myform.rg06.value);//闈㈢Н

var d1 = js01 - js02;
var d2 = Math.pow(1 + lilu, month) - 1;
var d3 = lilu * Math.pow(1 + lilu, month)

document.myform.rg07.value = Math.round(((d1 * d2) / d3) + js00);
document.myform.rg08.value = parseFloat(document.myform.rg07.value) / js03;
pl();
}


function closeCityList() {
if ($('searchExpert2').style.display != "none") $('searchExpert2').style.display = 'none';
}
function ChangeCity(city) { $('abcity').value = city; $('showcity').innerHTML = city; closeCityList() }


/*
*
*/
function gjjloan_write(obj) {
var gryjce;//浣忔埧鍏Н閲戜釜浜烘湀缂村瓨棰�
var poyjce;//閰嶅伓浣忔埧鍏Н閲戜釜浜烘湀缂村瓨棰�
var grjcbl;//缂村瓨姣斾緥
var pojcbl;//閰嶅伓缂村瓨姣斾緥
var xy; //涓汉淇$敤
var fwzj;//鎴垮眿鎬讳环
var fwxz;//鎴垮眿鎬ц川
var dknx;//璐锋鐢宠骞撮檺
var syhk; //棣栨湀杩樻棰�

var dked;//闇€瑕佽捶娆鹃搴�
var hkfs;//杩樻鏂瑰紡
var bxhj; //鏈伅鍚堣
var bxhj2; //鏈伅鍚堣绛夋湰閲�

//涓棿鍙橀噺
var gbl;
var jtysr; //瀹跺涵鏈堟敹鍏�
var r;//鏈堣繕娆�
var rb;
var gjjdka;//浣忔埧鍏Н閲戣捶娆鹃搴
var gjjdkb;//浣忔埧鍏Н閲戣捶娆鹃搴
var gjjdkc;//浣忔埧鍏Н閲戣捶娆鹃搴


gryjce = obj.mount2.value;
if (gryjce <= 0) {
alert('浣忔埧鍏Н閲戜釜浜烘湀缂村瓨棰濅笉鑳戒负绌�,璇疯緭鍏�.');
obj.mount2.value = '';
obj.mount.focus();
return;
}

poyjce = obj.mount3.value;
grjcbl = obj.jcbl.value / 100;
pojcbl = obj.p_bl.value / 100;
if (obj.xz[0].checked == true) { fwxz = 0.9; }
else { fwxz = 0.8; }

if (obj.xy[0].checked == true) { xy = 1.15; }
else if (obj.xy[1].checked == true) { xy = 1.3; }
else { xy = 1; }

fwzj = obj.mount.value;

if (fwzj <= 0) {
alert('鎴垮眿鎬讳环涓嶈兘涓虹┖,璇疯緭鍏�');
obj.mount.value = ''; return;
}

dknx = Math.round(obj.mount10.value);
if (dknx <= 0) {
alert('璐锋鐢宠骞撮檺涓嶈兘涓虹┖,璇疯緭鍏�');
obj.mount10.value = ''; return;
}

var bcv = 0;
if (dknx > 5) {
bcv = Math.round(1000000 * l6_30 / 12) / 1000000;
} else {
bcv = Math.round(1000000 * l1_5 / 12) / 1000000;
}
r = adv_format((10000 * bcv * Math.pow(1 + bcv, 12 * dknx)) / (Math.pow(1 + bcv, 12 * dknx) - 1), 2);

jtysr = Math.ceil((gryjce / grjcbl + poyjce / pojcbl) * 10) / 10;
gjjdka = Math.min(Math.round((jtysr - 400) / r * 10000 * 10) / 10, 800000);
gjjdkb = Math.round(gjjdka * xy * 10) / 10;
gjjdkc = Math.round(fwzj * fwxz * 10) / 10;

zgdk = obj.ze2.value; //鏈€楂樿捶娆鹃搴�

dked = Math.round(obj.need.value * 10) / 10;

obj.need.value = dked;

if (dked == 0) {
alert('闇€瑕佺殑璐锋棰濆害涓嶈兘涓虹┖,璇疯緭鍏�');
obj.need.value = ''; return;
}
if (dked < 0) {
alert('杈撳叆鐨勮捶娆鹃搴︿笉绗﹀悎瑕佹眰,璇疯緭鍏�');
obj.need.value = ''; return;
}


if (dked > zgdk) {
alert('涓嶈兘楂樹簬鏈€楂樿捶娆鹃搴�,璇烽噸鏂拌緭鍏�');
obj.need.value = ''; return;
}


hkfs = obj.select.value;//杩樻鏂瑰紡

if (hkfs == 1) {
var ylv_new;
if (dknx >= 1 && dknx <= 5)
ylv_new = l1_5 / 12;
else
ylv_new = l6_30 / 12;

var ncm = parseFloat(ylv_new) + 1;//n娆″箓
var dknx_new = dknx * 12;

total_ncm = Math.pow(ncm, dknx_new)

obj.ze22.value = Math.round(((dked * 10000 * ylv_new * total_ncm) / (total_ncm - 1)) * 100) / 100;
var pp = Math.round(((dked * 10000 * ylv_new * total_ncm) / (total_ncm - 1)) * 100) / 100;

gbl = Math.round(Math.ceil(dked * r * 100) / 100 / jtysr * 1000) / 10;
obj.yj2.value = gbl;
bxhj = Math.round(pp * dknx * 12 * 100) / 100;
obj.lx2.value = bxhj;
show(1);
}
if (hkfs == 2) {
if (dknx > 5) {
rb = l6_30 * 100;
} else {
rb = l1_5 * 100;
}

syhk = Math.round((dked * 10000 / (dknx * 12) + dked * 10000 * rb / (100 * 12)) * 100) / 100;
obj.sfk2.value = syhk;
var yhke; //鏈堣繕娆鹃
var bxhj; //鏈伅鍚堣
var dkys; //璐锋鏈堟暟
var sydkze;//褰撳墠鍓╀綑璐锋鎬婚
var yhkbj; //鏈堣繕娆炬湰閲�
dkys = dknx * 12;
yhkbj = dked * 10000 / dkys;

yhke = syhk;
sydkze = dked * 10000 - yhkbj;
bxhj = syhk;
for (var count = 2; count <= dkys; ++count) {
yhke = dked * 10000 / dkys + sydkze * rb / 1200;
sydkze -= yhkbj;
bxhj += yhke;
}
obj.lx3.value = Math.round(bxhj * 100) / 100;
show(2);
}
if (hkfs == 3) {

switch (dknx) {//鑷敱杩樻杩樻鏂瑰紡鏈堟渶浣庤繕娆鹃鍙傜収琛�,璋冩暣鍒╃巼涓嶄慨鏀�
case 1: rb = 83.04 / 100; break;
case 2: rb = 81.08 / 100; break;
case 3: rb = 79.12 / 100; break;
case 4: rb = 77.16 / 100; break;
case 5: rb = 75.20 / 100; break;
case 6: rb = 73.24 / 100; break;
case 7: rb = 71.28 / 100; break;
case 8: rb = 69.32 / 100; break;
case 9: rb = 67.36 / 100; break;
case 10: rb = 65.40 / 100; break;
case 11: rb = 63.44 / 100; break;
case 12: rb = 61.48 / 100; break;
case 13: rb = 59.52 / 100; break;
case 14: rb = 57.56 / 100; break;
case 15: rb = 55.60 / 100; break;
case 16: rb = 53.64 / 100; break;
case 17: rb = 51.68 / 100; break;
case 18: rb = 49.72 / 100; break;
case 19: rb = 47.76 / 100; break;
case 20: rb = 45.80 / 100; break;
case 21: rb = 43.84 / 100; break;
case 22: rb = 41.88 / 100; break;
case 23: rb = 39.92 / 100; break;
case 24: rb = 37.96 / 100; break;
case 25: rb = 36.00 / 100; break;
case 26: rb = 34.04 / 100; break;
case 27: rb = 32.08 / 100; break;
case 28: rb = 30.12 / 100; break;
case 29: rb = 28.16 / 100; break;
case 30: rb = 26.20 / 100; break;
}
var yhke; //鏈堣繕娆鹃
var ll;//鍒╃巼
var zhbj;//鏈€鍚庝竴鏈熸湰閲�
zhbj = Math.round(dked * 10000 * rb * 100) / 100;
if (dknx <= 5) {
ll = l1_5 / 12;
zdhkll = 0.0378 / 12;
var total_gjj = Math.pow(zdhkll + 1, dknx * 12);
syhk = Math.ceil(dked * 10000 * zdhkll * total_gjj / (total_gjj - 1));
}
else {
ll = l6_30 / 12;
zdhkll = 0.0423 / 12;
var total_gjj = Math.pow(zdhkll + 1, dknx * 12 - 1);
syhk = Math.ceil((dked * 10000 - zhbj) * zdhkll * total_gjj / (total_gjj - 1) + zhbj * zdhkll);
}
obj.sfk3.value = syhk; //鏈€浣庤繕娆鹃
var zhyqbj = dked * 10000;
var zchlx = 0;//鎬诲伩杩樺埄鎭�
for (i = 1; i < dknx * 12 ; i++) {
zchlx += Math.round(zhyqbj * ll * 100) / 100;
zhyqbj = Math.round((zhyqbj - (syhk - Math.round(zhyqbj * ll * 100) / 100)) * 100) / 100;
}
var sydkze = dked * 10000 - syhk;
obj.lx4.value = zhyqbj; //鏈€鍚庢湡鏈噾
obj.lx5.value = Math.round(zhyqbj * ll * 100) / 100;

zchlx += Math.round(zhyqbj * ll * 100) / 100;
obj.lx6.value = Math.round(zchlx * 100) / 100;
show(3);
}
}
function show(nid) {
for (i = 1; i < 4; i++) {
var oid = "re_inner_" + i;
if (i == nid)
document.getElementById(oid).style.display = "";
else
document.getElementById(oid).style.display = "none";
}
}

显示效果:贷款能力计算器

参考文章 :http://www.itmacom.com/gl/33456.html​​​​​​​

posted @ 2023-05-30 15:37  kaiser099  阅读(17)  评论(0编辑  收藏  举报