<html>
<head><title>One rep max</title>
<script type="text/javascript">
function calculateOneRepMax(){
var p = document.getElementById("button");
p.onclick = showAlert;
}
function showAlert(){
var weight = document.getElementById("weight").value;
var reps = document.getElementById("reps").value;
var orm = ((weight * reps )/ 30) + weight;
alert(orm);
}
</script>
</head>
<body onload="calculateOneRepMax()">
<form>
Weight: <input type="text" id="weight"/><br>
Reps: <input type="text" id="reps" /><br>
<input id="button" type="button" value="Calculate" onClick="calculateOneRepMax()" />
</form>
</body>
</html>
我想使用这个公式为举重中的一次最大次数创建一个计算器。(Weight * Reps)/30 + Weight
.
问题是脚本没有在(Weight * Reps)/30
.
这里有什么问题?