Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

186
Visualizações
Hide/Show video when button is pressed?

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.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

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*/";
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda