将变量从Javascript传递到HTML表单

时间:2017-10-22 06:44:27

标签: javascript html

我试图制作一个简单的理想体重计数器,我认为逻辑是正确的但是代码中一定有错,有人能告诉我它在哪里吗?谢谢..



<html>
<body>
  Height (Cm)
  <input type=text id="height"><br>
  <button onClick="Count()">Submit</button><br>
  Ideal Weight (Kg)
  <input type=text id="ideal"><br>
  
  <script>
    function Count()
    {
      var hei = document.getElementById('height').Value;
      var ideal = (hei - 100)- ((hei - 100)*0.1);
      document.getelementById('ideal').value = ideal;
    }
  </script>
</body>
</html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

我认为有两个问题:

var hei = document.getElementById('height').**v**alue;

document.get**E**lementById('ideal').value = ideal;