房贷计算器(源于新浪乐居)

发布时间:2025-12-09 17:10:05 浏览次数:4

因为用到 所以记录

 

房贷计算器:

效果图



 



 

 

新浪乐居图:



 

 

其中的计算公式按照新浪乐居的js代码进行计算,公式如下:

 

公共方法:

//本金还款的月还款额(参数: 年利率 / 贷款总额 / 贷款总月份 / 贷款当前月0~length-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);}

 1、等额本息

       (1)公积金/商业贷款

//2.本息还款//月均还款var month_money1 = getMonthMoney1(lilv, daikuan_total, month);//调用函数计算fmobj.month_money1.value = Math.round(month_money1 * 100) / 100 + "(元)";//还款总额var all_total1 = month_money1 * month;fmobj.all_total1.value = Math.round(all_total1 * 100) / 100;//支付利息款fmobj.accrual1.value = Math.round((all_total1 - daikuan_total) * 100) / 100;

 

 

       (2)混合贷款

//2.本息还款//月均还款var month_money1 = getMonthMoney1(lilv_sd, total_sy, month) + getMonthMoney1(lilv_gjj, total_gjj, month);//调用函数计算fmobj.month_money1.value = Math.round(month_money1 * 100) / 100 + "(元)";//还款总额var all_total1 = month_money1 * month;fmobj.all_total1.value = Math.round(all_total1 * 100) / 100;//支付利息款fmobj.accrual1.value = Math.round((all_total1 - daikuan_total) * 100) / 100;

 

  2、等额本金

       (1)公积金/商业贷款

//1.本金还款//月还款var all_total2 = 0;var month_money2 = "";for (j = 0; j < month; j++) {//调用函数计算: 本金月还款额huankuan = getMonthMoney2(lilv, daikuan_total, month, j);all_total2 += huankuan;huankuan = Math.round(huankuan * 100) / 100;//fmobj.month_money2.options[j] = new Option( (j+1) +"月," + huankuan + "(元)", huankuan);month_money2 += (j + 1) + "月," + huankuan + "(元)\n";}fmobj.month_money2.value = month_money2;//还款总额fmobj.all_total2.value = Math.round(all_total2 * 100) / 100;//支付利息款fmobj.accrual2.value = Math.round((all_total2 - daikuan_total) * 100) / 100;

 

 

       (2)混合贷款

        

for (j = 0; j < month; j++) {//调用函数计算: 本金月还款额huankuan = getMonthMoney2(lilv_sd, total_sy, month, j) + getMonthMoney2(lilv_gjj, total_gjj, month, j);all_total2 += huankuan;huankuan = Math.round(huankuan * 100) / 100;//fmobj.month_money2.options[j] = new Option( (j+1) +"月," + huankuan + "(元)", huankuan);month_money2 += (j + 1) + "月," + huankuan + "(元)\n";}fmobj.month_money2.value = month_money2;//还款总额fmobj.all_total2.value = Math.round(all_total2 * 100) / 100;//支付利息款fmobj.accrual2.value = Math.round((all_total2 - daikuan_total) * 100) / 100;

 

需要做网站?需要网络推广?欢迎咨询客户经理 13272073477