code
function toThousands(num) {
if (isNaN(num) || num == undefined || num == null || num == "") {
return "";
}
num = num.toString();
var numArr = num.split('.');
num = numArr[0];
var result = '';
while (num.length > 3) {
result = ',' + num.slice(-3) + result;
num = num.slice(0, num.length - 3);
}
if (num) { result = num + result; }
return result + '.' + numArr[1];
}
//四舍五入保留两位小数
var ta = (Math.round(6.327 * 100) / 100).toFixed(2);
C#:var grossWt = Math.Round(grossWt, 3, MidpointRounding.AwayFromZero);