I'm trying to make a BMI Calculator, and to play a video that correlates with the entered BMI. I can't figure out how to do it though. I want the video to only appear when the calculate button is pressed. My script to show the results so far. `<!-- SCRIPT -->
function BMI() {
var h=document.getElementById('h').value;
var w=document.getElementById('w').value;
var bmi=w/(h/100*h/100);
var bmio=(bmi.toFixed(2));
if (bmio < 18.5)
{
document.getElementById("result").innerHTML="You're Underweight, Your BMI is " + bmio;
}
if (bmio > 18.4 && bmio < 25 )
{
document.getElementById("result").innerHTML="You're Healthy, Your BMI is " + bmio ;
}
if (bmio > 24.9 && bmio < 30 )
{
document.getElementById("result").innerHTML="You're Overweight, Your BMI is " + bmio ;
}
if (bmio > 30 )
{
document.getElementById("result").innerHTML="You're Obese, Your BMI is " + bmio ;
}
}
` I don't know where to start, I'm a beginner to this. Sorry if I haven't clarified well enough.
You can set the display of the element to none and change it when the button is pressed.
document.getElementById(/*id of the element */).style.display="none";
document.getElementById(/*id of the element */).style.display="/*display*/";