Life Value

Life Value











body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f4;
}
.container {
width: 500px;
padding: 30px;
background-color: #d6eaf8 ;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
input[type=”date”] {
width: calc(100% – 12px);
padding: 6px;
margin-bottom: 20px;
}
button {
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
document.getElementById(‘addPerson’).addEventListener(‘click’, function() {
var personContainer = document.getElementById(‘personContainer’);
var newPerson = document.createElement(‘div’);
newPerson.classList.add(‘person’);
newPerson.innerHTML = `






`;
personContainer.appendChild(newPerson);
});

document.getElementById(‘lifeValueForm’).addEventListener(‘submit’, function(event) {
event.preventDefault();
var form = event.target;
var dobInputs = form.querySelectorAll(‘.dob’);
var currentDate = new Date();
var totalAge = 0;

dobInputs.forEach(function(input) {
var dob = new Date(input.value);
var age = currentDate.getFullYear() – dob.getFullYear();
totalAge += age;
});

document.getElementById(‘result’).innerText = “Your life value is ” + totalAge + ” years.”;
});

Enable Notifications OK No thanks