这是我的代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>The Raptor Astronomer</title>
<script>
function getQuantity()
{
var theForm = document.forms["formula"];
var radiusform = theForm.elements["radius"];
var radius =0;
if(radiusform.value!="")
{
radius = parseInt(radiusform.value);
var circumference = radius * 2 * Math.PI;
}
theForm.elements["circumference"].value = var circumference;
}
getQuantity();
</script>
</head>
<body>
<form id="formula">
<label>Radius</label>
<input id="radius" name="radius" type="text" />
<label>Circumference</label>
<input id="circumference" name="circumference" type="text"/>
</form>
</body>
</html>
据我从教程中可以看出,我的代码应该更新为圆周 - 不过我没有看到这种情况发生。
为什么这不能正常运行?我不包括触发器吗?需要触发吗?