js里用 toLocaleString 实现给数字加三位一逗号间隔(有无小数点都适用)
作者:互联网
<input type="hidden" id="totalLandArea" value="<%-info.totalLandArea%>">
<script>
//获得原数字
document.getElementById("totalLandArea").value;
//三位一逗号
var a = (<%-info.totalLandArea%>).toLocaleString(3)
//赋值
var b = document.getElementById("area").innerHTML = a
</script>
标签:toLocaleString,js,逗号,getElementById,三位,var,document 来源: https://www.cnblogs.com/myfighting/p/12213704.html