Demo entry 6625925

等额本息

   

Submitted by anonymous on Jun 22, 2017 at 15:55
Language: HTML. Code size: 2.1 kB.

<html>
<head>
<title>月供计算器</title>
<style type="text/css">

.container {
    
	width: 315px;
	height: 200px;
	
}
.dataTable {
  border:1px solid #cccccc;
  margin:0 auto;
  border-collapse:collapse;
  table-layout:fixed;
  display:table;
  width:100%;
}
.dataTable  tr{
  border-spacing:2px;
  border-color:gray;
}
.dataTable tr td {
  border: 1px solid #849cbc;
}
.input_label{
   text-align:left;
}
.title {
	text-align: center;
	height:26px;
	font-weight:600;
	background-color:#b2c5df;
	
}
#result {
   color: red;
}
</style>
<script type="text/javascript">
	function getPayByMonth(dke,ns,nll) {
        var pay = 0;
        var yll = nll / 12;
        pay = (dke * yll * (Math.pow((1 + yll), ns * 12)))
                / (Math.pow((1 + yll), ns * 12) - 1);
        return pay;
    }
    function cal(){
       var dke = document.getElementById("dke").value;
       var ns = document.getElementById("ns").value;
       var nll = document.getElementById("nll").value;
       var yg = getPayByMonth(dke,ns,nll/100);
       var zlx = (yg * 12 * ns - dke);
       document.getElementById("result").innerHTML="月供:"+yg.toFixed(2)+"元"+"<br/>利息:"+zlx.toFixed(2)+"元";
    }
</script>

</head>

<body>
	<div class="container">
	    <div class="title">等额本息计算器</div>
		<table class="dataTable">
			<tr>
				<td class="input_label">贷款额:</td>
				<td><input type="text" value="800000" id="dke" onkeyup="value=value.replace(/[^\d.]/g,'')"/></td>
			</tr>
			<tr>
				<td class="input_label">贷款年限:</td>
				<td><input type="text" value="30" id="ns" onkeyup="value=value.replace(/[^\d.]/g,'')"/></td>
			</tr>
			<tr>
				<td class="input_label">年利率(%):</td>
				<td><input type="text" value="4.0" id="nll" onkeyup="value=value.replace(/[^\d.]/g,'')"/></td>
			</tr>
			<tr>
				<td colspan="2" style="text-align:center;"><input type="button"
					value="计算" onclick="cal();"/></td>
			</tr>
			<tr>
				<td colspan="2"><div id="result">月供:<br/>利息:</div></td>
			</tr>
		</table>
	</div>
</body>
</html>

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).