Skip to content

Instantly share code, notes, and snippets.

@rodcisal
Created June 16, 2012 23:50
Show Gist options
  • Save rodcisal/2942882 to your computer and use it in GitHub Desktop.
Save rodcisal/2942882 to your computer and use it in GitHub Desktop.
Calculadora de IMC on-the-fly
<script type="text/javascript">
function calcular(a,b) {
imc = (a / (b*b));
document.getElementById("resultado").innerHTML = Math.round(imc*10)/10;
if (imc<=19.90) {
document.getElementById("diagnostico").innerHTML= " Desnutrición";
}
else if (imc>19.90 && imc<=25) {
document.getElementById("diagnostico").innerHTML= " Peso Normal";
}
else if (imc>25 && imc <= 29.99) {
document.getElementById("diagnostico").innerHTML= " Sobrepeso";
}
else if (imc>=30 && imc <= 34.99) {
document.getElementById("diagnostico").innerHTML= " Obesidad tipo I (moderada)";
}
else if (imc>=35 && imc<=39.99) {
document.getElementById("diagnostico").innerHTML= " Obesidad tipo II (severa)";
}
else if(imc>=40 && imc<=49.99) {
document.getElementById("diagnostico").innerHTML= " Obesidad tipo III (Mórbida)"
}
else if (imc>=50){
document.getElementById("diagnostico").innerHTML= " Obesidad Extrema"
}
else
{
document.getElementById("diagnostico").innerHTML= "none";
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment