JavaScript converts numbers to Chinese and javascript to Chinese
Var _ change = {ary0: ["zero", "one", "two", "three", "four", "five", "Six", "Seven ", "Eight", "Nine"], ary1: ["", "Ten", "Hundred", "Thousand"], ary2: ["", "Ten Thousand ", "", "MB"], init: function (name) {this. name = name ;}, strrev: function () {var ary = [] for (var I = this. name. length; I> = 0; I --) {ary. push (this. name [I])} return ary. join ("") ;}, // reverse the string. Pri_ary: function () {var $ this = this var ary = this. strrev (); var zero = "" var newary = "" var i4 =-1 for (var I = 0; I <ary. length; I ++) {if (I % 4 = 0) {// first judge the ten-level unit. Every four characters increase the index number of the TEN-level unit array by i4 ++; newary = this. ary2 [i4] + newary; // stores tens of thousands of units in the read method of the character. It must be placed at the end of the read method of the current character, so it is first stacked into $ r, zero = ""; // The "0" in the unit of 10 million must be read, so the zero read method is set to null} // processing and judgment on 0. If (ary [I] = '0') {// if the read character is "0 ", run the following command to determine whether the "0" is read as "0" switch (I % 4) {case 0: break; // if the location index can be divisible by 4, it indicates that it is in the unit of tens of thousands. The reading method of 0 in this position has been set before, so skip case 1: case 2: case 3: if (ary [I-1]! = '0') {zero = "zero"}; // if it is not divided by 4, execute this Code: if its next digit (for the current string, it is the previous character, because it was previously reversed) is also 0, skip it; otherwise, read it as "zero" break ;} newary = zero + newary; zero = '';} else {// if not" 0 "newary = this. ary0 [parseInt (ary [I])] + this. ary1 [I % 4] + newary; // converts the character to a numeric value and uses it as the index number of the array ary0 to obtain the corresponding Chinese reading method, then, it will keep up with its level 1 unit (null, ten, hundred or thousands) and add the previously saved read content.} If (newary. indexOf ("zero") = 0) {newary = newary. substr (1)} // process the previous 0 return newary;} // create a class function change () {this. init. apply (this, arguments);} change. prototype = _ change // create an instance var k = new change ("00102040"); alert (k. pri_ary ())