简体   繁体   English

将变量从 Javascript 传递到 HTML 表单

[英]Passing Variable From Javascript to HTML Form

Im trying to make a simple ideal weight counter, i thought the logic is correct but there must be a fault in the codes, can someone show me where is it..?我正在尝试制作一个简单的理想重量计数器,我认为逻辑是正确的,但代码中一定有问题,有人可以告诉我它在哪里..? Thank you..谢谢..

 <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>

I think there are two issues:我认为有两个问题:

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

and

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM