付款总额:
$总利息:
$CSS
#myTable {
margin: auto;
}
.output {
font-weight: bolder;
}
#payment {
text-decoration: underline;
}
#graph {
border: solid black 1px;
}
th td {
vertical-align: top;
}
button {
cursor: pointer;
}
JS
function calculate() {
// 贷款金额
let amount = document.getElementById(‘amount’);
// 年利息
let apr = document.getElementById(‘apr’);
// 还款期
let years = document.getElementById(‘years’);
// 首期付款
let firstPut = document.getElementById(‘firstPut’);
if (firstPut.value == “”) {
firstPut.value = 0
} //没有输出则默认首期付款为0
// 每月支付
let