I always get NaN in the box that should output the result, I could not get something to help me on the internet.
Calculating BMI!
<script>
calcularIMC = function (){
var peso = document.getElementById("peso").value;
var altura = document.getElementById("altura").value;
var imc = (peso/Math.pow(altura,2));
document.getElementById("imc1").value = eval(imc);
}
</script>
</head>
<body>
<form class="form-horizontal">
<fieldset>
<!-- Form Name -->
<center><legend>Caculadora de IMC</legend></center>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for = "altura">Altura</label>
<div class="col-md-4">
<input id="altura" name = "altura"
type="text"
placeholder="#,## m"
class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for = "peso">Peso</label>
<div class="col-md-4">
<input id="peso"
name="peso"
type="text"
placeholder="###,## kg"
class="form-control input-md">
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for=""></label>
<div class="col-md-4">
<type = "button" class="btn btn-primary"
id = "resultadoIMC"
onclick = "calcularIMC()">Calcular IMC</button>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="imc">IMC</label>
<div class="col-md-4">
<input id="imc1"
type = "text"
class="form-control input-md"><br>
</div>
</div><br>
</fieldset>
</form>
</body>
</html>