BMR Calculator body { font-family: Arial, sans-serif; color: #333; background-color: #f5f5f5; } h1 { text-align: center; font-size: 2em; margin: 0; } form { max-width: 500px; margin: 0 auto; padding: 20px; background-color: #fff; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } form label { display: block; margin-bottom: 8px; font-size: 1.2em; } form input[type="radio"] { width: auto; height: auto; } form input[type="number"] { width: 100%; height: 40px; padding: 0 10px; font-size: 1.2em; border: 1px solid #ddd; border-radius: 5px; } form input[type="submit"] { margin-top: 20px; width: 100%; height: 40px; background-color: #333; color: #fff; font-size: 1.2em; border: none; border-radius: 5px; cursor: pointer; } BMR Calculator Enter your information below to calculate your BMR: Gender: Male Female Age: Weight (kg): Height (cm): // Get the form element const form = document.querySelector('form'); // Add a submit event listener to the form form.addEventListener('submit', e = { // Prevent the form from refreshing the page e.preventDefault(); // Get the values of the form fields const gender = document.querySelector('input[name="gender"]:checked').value; const age = document.querySelector('#age').value; const weight = document.querySelector('#weight').value; const height = document.querySelector('#height').value; // Calculate the BMR using the Harris-Benedict equation let bmr; if (gender === 'male') { bmr = 66 + (13.7 * weight) + (5 * height) - (6.8 * age); } else if (gender === 'female') { bmr = 655 + (9.6 * weight) + (1.8 * height) - (4.7 * age); } // Display the result in the placeholder div document.querySelector('#result').innerHTML = `Your BMR is: ${bmr} calories per day.`; });