PPF Calculator html code online - Free html code with java script for PPF Calculator
Here is a code for PPF calculator online
<html>
<head>
<title>PPF Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin-top: 100px;
}
label {
font-weight: bold;
}
input[type="number"] {
padding: 8px;
font-size: 16px;
border-radius: 5px;
border: 1px solid #ccc;
}
button {
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
border: none;
background-color: #4CAF50;
color: white;
cursor: pointer;
}
#result {
margin-top: 20px;
font-size: 18px;
font-weight: bold;
}
</style>
</head>
<body>
<h1>PPF Calculator</h1>
<label for="principal">Enter your initial investment amount:</label>
<br />
<input id="principal" min="500" required="" step="100" type="number" />
<br />
<label for="addon">Enter your annual investment add-on:</label>
<br />
<input id="addon" min="0" step="100" type="number" />
<br />
<label for="rate">Select interest rate (%):</label>
<br />
<select id="rate">
<option value="6.4">6.4%</option>
<option value="6.8">6.8%</option>
<option value="7.1">7.1%</option>
<option value="7.5">7.5%</option>
<option value="7.9">7.9%</option>
<option value="8.3">8.3%</option>
</select>
<br />
<label for="duration">Select investment duration (in years):</label>
<br />
<select id="duration">
<option value="5">5 years</option>
<option value="10">10 years</option>
<option value="15">15 years</option>
<option value="20">20 years</option>
<option value="25">25 years</option>
<option value="30">30 years</option>
</select>
<br />
<button onclick="calculatePPF()">Calculate</button>
<div id="result"></div>
<script>
function calculatePPF() {
var principal = parseInt(document.getElementById("principal").value);
var addon = parseInt(document.getElementById("addon").value) || 0;
var rate = parseFloat(document.getElementById("rate").value);
var duration = parseInt(document.getElementById("duration").value);
var totalAmount = principal;
for (var i = 1; i <= duration; i++) {
totalAmount += (totalAmount * rate) / 100;
totalAmount += addon;
}
document.getElementById("result").innerHTML = "Your PPF maturity amount after " + duration + " years: " + totalAmount.toFixed(2);
}
</script>
</body>
Comments
Post a Comment