JS 添加千分位,测试可以使用
<script language="javascript" type="text/javascript">
function comdify(n){
var re=/d{1,3}(?=(d{3})+$)/g;
var n1=n.replace(/^(d+)((.d+)?)$/,function(s,s1,s2){return s1.replace(re,"$&,")+s2;});
return n1;
}
</script>
<input type="text" value="1212133345.78" onblur="this.value=comdify(this.value)">