function numToCny (Money) {
var cnNums = new new the Array ( "zero", "one", "two", "three", "market", "Wu", "land", "qi", "split", "Nine "); // characters digital
var cnIntRadice = new Array (" " ," pick up "," Bai "," thousand "); // basic unit
var cnIntUnits = new Array (" " ," Wan "," 100 million " "Precursors"); // expansion unit corresponding to the integer part
var cnDecUnits = new Array ( "angle", "minute", "mmol", "PCT"); // units corresponding to the decimal part
var cnInteger = "integer"; / when / integer value followed by the character
var cnIntLast = "meta"; // End integer unit after
var maxNum = 999999999999999.9999; // largest digital processing
var IntegerNum; // integer portion of the amount
var DecimalNum; // Amount fractional part
var ChineseStr = ""; // output Chinese amount string
var parts; // the amount of separation with an array of predefined
if (money == "") {
return "";
}
= parseFloat Money (Money);
// Alert (Money);
IF (Money> = maxNum) {
$ .alert ( 'exceeds the maximum processing digital');
return "";
}
IF (Money == 0) {
ChineseStr = cnNums [0] + + cnIntLast cnInteger;
//document.getElementById("show").value=ChineseStr;
return ChineseStr;
}
Money money.toString = (); // into a string
if (money.indexOf ( "." ) == -1) {
IntegerNum = Money;
DecimalNum = '';
} the else {
Parts money.split = ( ".");
IntegerNum = parts[0];
DecimalNum = parts[1].substr(0, 4);
}
if (parseInt(IntegerNum, 10) > 0) {//获取整型部分转换
zeroCount = 0;
IntLen = IntegerNum.length;
for (i = 0; i < IntLen; i++) {
n = IntegerNum.substr(i, 1);
p = IntLen - i - 1;
q = p / 4;
m = p % 4;
if (n == "0") {
zeroCount++;
} else {
if (zeroCount > 0) {
ChineseStr += cnNums[0];
}
ZeroCount = 0; // zero
ChineseStr + = cnNums [the parseInt (n-)] + cnIntRadice [m];
}
IF (m == 0 && zeroCount <. 4) {
ChineseStr cnIntUnits + = [Q];
}
}
ChineseStr + cnIntLast =;
// integer part processed
}
IF (DecimalNum = ''!) {// fractional part
decLen = DecimalNum.length;
for (I = 0; I <decLen; I ++) {
n-DecimalNum.substr = (I ,. 1);
! IF (n-= '0') {
ChineseStr += cnNums[Number(n)] + cnDecUnits[i];
}
}
}
if (ChineseStr == '') {
ChineseStr += cnNums[0] + cnIntLast + cnInteger;
} else if (DecimalNum == '') {
ChineseStr += cnInteger;
}
return ChineseStr;
}