Your MAF Heart Rate:
–
Remember, this is an estimate. It's always best to listen to your body and consult with a coach or healthcare professional for personalized guidance.
.calculator-container {
font-family: sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
background-color: #f9f9f9;
}
.calculator-form h2 {
text-align: center;
color: #333;
margin-bottom: 15px;
}
.calculator-form p {
color: #555;
line-height: 1.6;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #444;
}
.form-group input {
width: calc(100% – 20px);
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.calculator-form button {
width: 100%;
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
.calculator-form button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 30px;
padding: 15px;
border-top: 1px solid #eee;
text-align: center;
}
.calculator-result h3 {
color: #333;
margin-bottom: 10px;
}
#mafResult {
font-size: 24px;
font-weight: bold;
color: #28a745;
margin-bottom: 15px;
}
.calculator-result p:last-of-type {
font-size: 12px;
color: #777;
margin-top: 10px;
}
function calculateMafHeartRate() {
var ageInput = document.getElementById("age");
var mafResultDisplay = document.getElementById("mafResult");
var age = parseFloat(ageInput.value);
if (isNaN(age) || age <= 0) {
mafResultDisplay.textContent = "Please enter a valid age.";
return;
}
// MAF Heart Rate Formula: 180 – Age
var mafHeartRate = 180 – age;
mafResultDisplay.textContent = mafHeartRate + " bpm";
}