js阿拉伯数字转中文大写

function changeNum(sText){
   var arr1 = ['一','二','三','四','五','六','七','八','九'];
   var arr2 =['亿','千万','百万','十万','万','千','百','十','元'];
   var str = '';
   var sResult = '';
   for(var i =0;i<sText.length;i++){
    str += arr1[sText.charAt(i)-1];
    //str = '四三五三四';
   }   
   var len = arr2.length - str.length;//sText的长度
   var arr3 = arr2.slice(len);
   for(var i =0;i<str.length;i++){
    sResult+=str[i]+arr3[i];
   }
   //return arr3['万','千','百','十','元'];
   return sResult;
  }
 console.log (changeNum("43534"))
posted @ 2013-12-15 00:02  清澄小小鱼  阅读(174)  评论(0编辑  收藏  举报