JavaScript中Float类型保留两位小数 实现代码如下: var amount = parseFloat(document.getElementById("controlID").innerText).toFixed(2);