我需要它做一个数学方程式,然后在“结果为:”下吐出答案 当我按下按钮时,数字消失了,这意味着正在工作,但是没有答案。 有人看到错误了吗?
<head>
<h1>Slugging Percentage Calculator</h1>
<link rel= "stylesheet" href="thisisforlab7.css">
<title>Lab 7</title>
<script>
function theCalculate(){
atbat = document.getElementById("two").value;
singles = document.getElementById("three").value;
doubles = document.getElementById("four").value;
triples = document.getElementById("five").value;
hr = document.getElementById("six").value;
document.getElementById("result").innerHTML = (singles + (2 * doubles) + (3 * triples) + (4 * hr) / atbat);
}
</script>
<body>
<form>
<h4>Batters Name: <input type= "text" name= "one"><br></h4>
<h4>Enter Number of At Bats: <input type= "text" name= "two"/> <br></h4>
<h4>Enter Number of Singles: <input type= "text" name= "three"/><br></h4>
<h4>Enter Number of Doubles: <input type= "text" name= "four"/><br></h4>
<h4>Enter Number of Triples: <input type= "text" name= "five"/><br></h4>
<h4>Enter Number of Home Runs: <input type= "text" name= "six"/> <br></h4>
<button onclick= "theCalculate()"> What's the Slugging Percentage?</button>
<h3> The Result is: </h3> <br>
<span id= "result"></span>
</form>
</body>