<script language="javascript">
function transfer()
{
var input=document.forms[0].elements['xiao'].value;
vardanwei=Array("","十","百","千","万","十","百","千","亿");
varinputvalue=parseInt(input);
var l=input.length;
var a=new Array(l);
var b=new Array(l);
var result="";
for(var i=0;i<l;i++)
{
a[i]=input.substr(i,1);
b[i]=getchinese(a[i]);
result+=b[i]+danwei[l-i-1];
}
document.forms[0].elements['da'].value=result;
}
function getchinese(p)
{
varinput=p;
if(input=="0")
return "零";
elseif(input=="1")
return "壹";
else if(input=="2")
return "贰";
else if(input=="3")
return "叁";
else if(input=="4")
return "肆";
else if(input=="5")
return "伍";
else if(input=="6")
return "陆";
else if(input=="7")
return "柒";
else if(input=="8")
return "捌";
else if(input=="9")
return "玖";
}
</script>
<body>
<form>
<input type="text" name="xiao" /><br>
<input type="button"onclick="transfer()" value="数字转换"/><br>
<input type="text" name="da"readonly="true" size="30"/>
</form>
</body>