0
我想要一个简单的计算表单。 我把W3Schools的TE的例子:html输出2位
,这是MYD调整代码:
<!DOCTYPE html>
<html>
<body>
<form oninput="x.value=parseFloat(a.value).round(2)* parseFloat(b.value).round(2)">
<input type="number" id="a" value="50">
+<input type="number" id="b" value="50">
=<output name="x" for="a b"></output>
</form>
<p><strong>Note:</strong> The output tag is not supported in Internet Explorer.</p>
</body>
</html>
当我添加了轮(2)(形成oninput),那么它将无法工作。 如果我删除它,它将工作。但是如果我在小数点后面添加一些数字,我会得到一大堆有很多零的数字。
我只想要一个2位输出。
任何人都可以帮助我吗?
我也签此链接:
parse float with two decimal places
,但我不能让它工作