<html>
<head>
<title>IMC</title> <script language="javascript">
function imc () {
var p=eval(formulario.peso.value);
var a=eval(formulario.altura.value);
var r=p/(a*a); formulario.resultado.value=r;
if(r<18.5){formulario.estado.value="infrapeso"}
else if(r<25){formulario.estado.value="normal"}
else if(r<30){formulario.estado.value="sobrepeso"}
else if(r>29.9){formulario.estado.value="obeso"}
}
</script>
</head>
<body>
<h1>CALCULA TU IMC</h1><br>
<form name="formulario">
peso <input type="text" name="peso"><br>
altura (con puntos) <input type="text" name="altura"><br>
imc <input type="text" name="resultado" readonly><br>
estado <input type="text" name="estado" readonly><br>
<input type="button" value="calcular" onclick="imc()">
<input type="reset" value="limpiar">
</form>
</body>
</html>