//千分位分割 function toThousands(num) { var result = '', counter = 0; num = (num || 0).toString(); for (var i = num.length - 1; i >= 0; i--) { counter++; result = num.charAt(i) + result; if (!(counter % 3) && i != 0) { result = ',' + result; } } return result; } function renderNum(num){ var cur_num = null; var string_num = (num||0).toString(); var spot_index = string_num.indexOf('.'); if(spot_index == -1){ cur_num = toThousands(num); }else{ var cur_spot_num = string_num.substring(spot_index); num = string_num.substring(0,spot_index); cur_num = toThousands(num); cur_num = cur_num+cur_spot_num; } return cur_num } renderNum(1234.45);