标签:
function format_double(value){ var num = parseFloat(value); num = num.toFixed(2)+""; var str = num.split(".")[0]; var lis = num.split(".")[1]; var siz = 0; var result = ""; for (var i=str.length-1;i>=0;i--){ siz++; if (siz%3==0){ siz=0; result = ","+str.substr(i,3)+result; } } if (str.length%3 != 0){ result = str.substr(0,str.length%3)+result; }else{ result = result.substring(1,result.length); } return result+"."+lis; }
标签:
原文地址:http://my.oschina.net/u/2284472/blog/515277