function commafy() {
var num = document
//
num = num + "";
num = num
if (num == "") {
alert("空值
return;
}
if (isNaN(num)) {
alert("非數
return;
}
//
var index = num
if (index==
var reg = /(
while (reg
num = num
}
} else {
var intPart = num
var pointPart = num
var reg = /(
while (reg
intPart = intPart
}
num = intPart +"
}
return alert(num);
}
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20402.html