<html>
<body>
<script type="text/
javascript">
/**
* 金额
大小写转换
* Edit www.jb200.com
*/
var stmp = "";
function nst(t)
{
if(t.value==stmp) return;
var ms = t.value.replace(/[^d.]/g,"").replace(/([url=file://%20%20.%20%20d%7b2%7d).+$/,%22$1%22).replace(/%5E0+([1-9])/,%22$1%22).replace(/%5E0+$/,%220].d{2}).+$/,"$1").replace(/^0+([1-9])/,"$1").replace(/^0+$/,"0");
var ms = t.value;
var txt = ms.split(".");
while(/d{4}(,|$)/.test(txt[0]))
txt[0] = txt[0].replace(/([url=file://%20%20d)(%20%20d%7b3%7d(,%7c$))/,%22$1,$2]d)(d{3}(,|$))/,"$1,$2");
t.value = stmp = txt[0]+(txt.length>1?"."+txt[1]:"");
bbb.value = number2num1(ms-0);
}
function number2num1(strg)
{
var number = Math.round(strg*100)/100;
number = number.toString(10).split(".");
var a = number[0];
if (a.length > 12)
return "数值超出范围!支持的最大数值为 999999999999.99";
var e = "零壹贰叁肆伍陆柒捌玖";
var num1 = "";
var len = a.length-1;
for (var i=0 ; i<=len; i++)
num1 += e.charAt(parseInt(a.charAt(i))) + [["圆","万","亿"][Math.floor((len-i)/4)],"拾","佰","仟"][(len-i)%4];
if(number.length==2 && number[1]!="")
{
var a = number[1];
for (var i=0 ; i<a.length; i++)
num1 += e.charAt(parseInt(a.charAt(i))) + ["角","分"];
}
num1 = num1.replace(/零佰|零拾|零仟|零角/g,"零");
num1 = num1.replace(/零{2,}/g,"零");
num1 = num1.replace(/零(?=圆|万|亿)/g,"");
num1 = num1.replace(/亿万/,"亿");
num1 = num1.replace(/^圆零?/,"");
if(num1!="" && !/分$/.test(num1))
num1 += "整";
return num1;
}
</script>
小写金额:<input type="text" name="aaa" onkeyup="nst(this)"><br>
大写金额:<input type="text" name="bbb" size=80>
</body>
</html>