<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
#isa-calculator {
max-width: 400px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
label {
display: block;
margin-bottom: 5px;
}
input {
width: 100%;
padding: 8px;
margin-bottom: 10px;
box-sizing: border-box;
}
button {
background-color: #4caf50;
color: white;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
</style>
<title>ISA Calculator</title>
</head>
<body>
<div id="isa-calculator">
<label for="initial-investment">Initial Investment:</label>
<input type="number" id="initial-investment" />
<label for="annual-contribution">Annual Contribution:</label>
<input type="number" id="annual-contribution" />
<label for="interest-rate">Interest Rate (%):</label>
<input type="number" id="interest-rate" />
<label for="investment-period">Investment Period (years):</label>
<input type="number" id="investment-period" />
<button onclick="calculateISA()">Calculate</button>
<p id="result"></p>
</div>
<script>
function calculateISA() {
var initialInvestment = parseFloat(document.getElementById('initial-investment').value);
var annualContribution = parseFloat(document.getElementById('annual-contribution').value);
var interestRate = parseFloat(document.getElementById('interest-rate').value) / 100;
var investmentPeriod = parseFloat(document.getElementById('investment-period').value);
var total = initialInvestment;
for (var i = 1; i <= investmentPeriod; i++) {
total += annualContribution;
total *= (1 + interestRate);
}
document.getElementById('result').innerHTML = 'Total ISA Value: $' + total.toFixed(2);
}
</script>
</body>
</html>