Psyduck - 可達鴨 之 鴨力山大
Current File : /home/irplbiz/public_html/demo_dev/sip/index.html |
<!DOCTYPE html>
<html>
<head>
<title>SIP Calculator</title>
<style>
body { font-family: Arial; margin: 40px; }
.container { max-width: 400px; margin: auto; }
input, button { width: 100%; padding: 10px; margin: 10px 0; }
.result { margin-top: 20px; font-weight: bold; }
</style>
</head>
<body>
<div class="container">
<h2>SIP Calculator</h2>
<form id="sipForm">
<label>Monthly Investment (₹):</label>
<input type="number" id="monthlyInvestment" required>
<label>Investment Duration (Years):</label>
<input type="number" id="investmentPeriod" required>
<label>Expected Annual Return (%):</label>
<input type="number" step="0.1" id="expectedReturn" required>
<button type="submit">Calculate</button>
</form>
<div class="result" id="result"></div>
</div>
<script>
document.getElementById('sipForm').addEventListener('submit', function(e) {
e.preventDefault();
const monthlyInvestment = parseFloat(document.getElementById('monthlyInvestment').value);
const years = parseInt(document.getElementById('investmentPeriod').value);
const annualReturn = parseFloat(document.getElementById('expectedReturn').value);
const n = years * 12;
const r = annualReturn / 12 / 100;
const maturityAmount = monthlyInvestment * (((Math.pow(1 + r, n)) - 1) * (1 + r) / r);
const investedAmount = monthlyInvestment * n;
const gain = maturityAmount - investedAmount;
document.getElementById('result').innerHTML = `
Total Invested: ₹${investedAmount.toFixed(2)}<br>
Estimated Returns: ₹${gain.toFixed(2)}<br>
Maturity Amount: ₹${maturityAmount.toFixed(2)}
`;
});
</script>
</body>
</html>