等额本金irr计算器
```html
body {
fontfamily: Arial, sansserif;
margin: 20px;
padding: 0;
}
h1 {
textalign: center;
}
form {
maxwidth: 400px;
margin: 0 auto;
}
label {
display: block;
marginbottom: 5px;
}
input[type="text"] {
width: 100%;
padding: 8px;
marginbottom: 10px;
border: 1px solid ccc;
borderradius: 4px;
boxsizing: borderbox;
}
input[type="submit"] {
width: 100%;
padding: 10px;
backgroundcolor: 4CAF50;
color: white;
border: none;
borderradius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
backgroundcolor: 45a049;
}
result {
margintop: 20px;
padding: 10px;
border: 1px solid ccc;
borderradius: 4px;
}
等额本息贷款计算器
document.getElementById('loanForm').addEventListener('submit', function(event) {
event.preventDefault();
var loanAmount = parseFloat(document.getElementById('loanAmount').value);
var annualInterestRate = parseFloat(document.getElementById('annualInterestRate').value) / 100;
var loanTerm = parseInt(document.getElementById('loanTerm').value);
var monthlyInterestRate = annualInterestRate / 12;
var monthlyPayment = loanAmount * monthlyInterestRate * Math.pow(1 monthlyInterestRate, loanTerm) / (Math.pow(1 monthlyInterestRate, loanTerm) 1);
var totalPayment = monthlyPayment * loanTerm;
var totalInterest = totalPayment loanAmount;
var resultHTML = `
贷款金额:¥${loanAmount.toFixed(2)}
年利率:${(annualInterestRate * 100).toFixed(2)}%
贷款期限:${loanTerm} 月
¥${monthlyPayment.toFixed(2)}
¥${totalPayment.toFixed(2)}
¥${totalInterest.toFixed(2)}
`;
document.getElementById('result').innerHTML = resultHTML;
});