<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="./18.案例的css.css">
</head>
</style>
<body>
<script>
let a = prompt('请输入贷款金额(万元)')
let b = prompt('请输入贷款年限(年)')
function pay(p,y){
let r = 0.049 / 12
let n = y *12
return (p*r*Math.pow(1+r,n) / ((Math.pow(1+r,n))-1))*10000
}
let c = pay(a,b)
document.write(`
<div>
根据正常银行贷款评估,您需要每月还款<span class="aaa">[${c}]元</span>
</div>
`)
</script>
</body>
</html>
案例-Math方法-房贷每月还款
最新推荐文章于 2021-08-03 13:36:24 发布