我需要获得两个用户定义数字的平均值。但是,当您输入小数时,除法功能不起作用,就好像它被忽略一样。
这是我的javascript:
var boxamnt = "tempvalue for amount of boxes will change this later as needed";
var x = parseInt(document.getElementById('value1').value);
var y = parseInt(document.getElementById('value2').value);
var abc = x + y;
var total = abc/"2.00000000000000";
alert(total);
这是我的表格:
First value: <input type="number" name="FirstValue" placeholder="Number" id="value1" step=".00000000000000"><br>
Second value: <input type="number" name="NextValue" placeholder="Number" id="value2" step=".00000000000000"><br>