function calculateSynthrapol() { var weight = document.getElementById('fiberWeight').value; var minSynthrapol = weight * 0.005; // 0.5% of the weight var maxSynthrapol = weight * 0.01; // 1% of the weightvar result = document.getElementById('result'); if(weight === "" || isNaN(weight) || weight <= 0) { result.innerHTML = "Please enter a valid weight in ounces."; } else { result.innerHTML = `For ${weight} ounces of fiber, use between ${minSynthrapol.toFixed(2)} to ${maxSynthrapol.toFixed(2)} ounces of Synthrapol.`; } }