JavaScript数字格式化方法:千分位,百分数
//数字格式化,保留两位小数并每三位加逗号 function formatThousand2(data) { return number_format(data, 2,".",","); } //数字格式化,不保留小数并每三位加逗号 function formatThousand(data) { return number_format(data, 0,".",","); } //小数转换为分数(小数先转换成number类型,再乘以100,并且保留2位小数) function formatPercent2(point){ if(null == point){ return "--"; } var percent = (point*100).toFixed(2); percent+="%"; return percent; }