当我使用 innerHTML 测试我的代码时,给出了 var num1=57; 得到正确的结果 73.375,现在当输入数字 57 时更改代码以使用带有输入类型文本框的表单时,它会将预期结果更改为 629.625 .. 对此的任何帮助将不胜感激
<!DOCTYPE html>
<head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
      <link rel="style" href="css/main.css"  type"text/css"/>
      <title> Get final width </title>
      <script type= "text/javascript">
            function sum()
            {
            var num1;
            num1= document.getvalue.width.value;
            var acc1 = (num1 + 0.625)/(6.25-0.5); 
            var acc2 = Math.ceil((acc1 * 10) / 10) * 6.25 + (4.125 + 0.5);
            document.getElementById('finalwidth').value = (acc2).toFixed(3);
            document.getElementById("finalwidth").readOnly=true;
            }
      </script>       
</head>
<body>
            <div>
            <h3> when input is 57  final width result should be : 73.375</h3>
            <h3> when input is 100  final width result should be : 117.125</h3>
            </div>
            <form name= "getvalue">
                    <label for="width"> Width: </label>
                    <input type="text" name="width" maxlength="5" size="10" value=""/>
                    <input type="button" name="button" Value="calculate" onclick="sum()"/>
                    <label for="finalwidth"> Final width: </label>
                    <input type="text" id="finalwidth" name="finalwidth" maxlength="4" size="10" value=""/>
            </form> 
</body>