I’m a student who has to do a mandatory course in “information technology” which involves a bit of programming. I’ve managed to get all my scripts to work except for this one. It’s essentially a tiny program that requires you to input your height and weight, and it ought to calculate your BMI. Except, when I input some numbers and press the button, nothing happens. As I said, I barely know anything about programming, so I would prefer your simplest solutions. Thanks in advance!
<!DOCTYPE html>
<html lang=”en” dir=”ltr”>
<head>
<meta charset=”utf-8″>
<style>
#bmi
{
padding: 5px;
width: 150px;
background-color: #ccc;
font-weight: bold;
}
</style>
<script>
document.getElementById(“btBMI”).onclick=function()
{
var v=document.getElementById(“v”).value;
var h=document.getElementById(“h”).value;
var BMI=v/(h/100*h/100);
document.getElementById(“bmi”).innerHTML=bmi.toPrecision(3);
}
</script>
<title></title>
</head>
<body>
<input type=”text” id=”v”> Input your weight in kilograms<br>
<input type=”text” id=”h”> Input your height in centimetersr<br>
<button id=”btBMI”>Calculate BMI</button>
<div id=”bmi”>Your BMI:</div>
</body>
</html>