如何在JavaScript中舍入十进制结果

时间:2018-09-12 06:00:09

标签: javascript

我想舍入来自“ document.getElementById('Edit_total_price')。value = result1;”的结果到javaScript中的两个小数位。这是我的整体代码

function edit_calculate() {
            var myBox1 = document.getElementById('Editprevious_reading').value;
            var myBox2 = document.getElementById('Editcurrent_reading').value;
            var myBox3 = document.getElementById('Edit_total_sale').value;
            var Edit_total_sale = document.getElementById('Edit_total_sale').value;
            var myResult = myBox2 - myBox1;
            var result1 = document.getElementById('price').value * myResult;
            document.getElementById('Edit_total_sale').value = myResult;
            document.getElementById('Edit_total_price').value = result1;

        }

0 个答案:

没有答案