runxinzhi.com
首页
百度搜索
数字翻译成英语
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <script type="text/javascript"><!-- var arr1=new Array(""," thousand"," million"," billion") var arr2=new Array("zero","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety") var arr3=new Array("zero","one","two","three","four","five","six","sever","eight","nine"); var arr4=new Array("ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"); function Translate(num){ var len=num.length,i,j=0,strRet=""; var cols=Math.ceil(len/3); var first=len-cols*3 var strRet="" for(i=first;i<len;i+=3){ ++j; if(i>=0) num3=num.substring(i,i+3) else num3=num.substring(0,first+3) strEng=English(num3) if(strEng!=""){ if(strRet!="") strRet+="," strRet+=English(num3)+arr1[cols-j] } } return strRet } function English(num){ strRet="" if((num.length==3)&&(num.substr(0,3)!="000")){ if((num.substr(0,1)!="0")){ strRet+=arr3[num.substr(0,1)]+" hundred" if(num.substr(1,2)!="00")strRet+=" and " } num=num.substring(1); } if((num.length==2)){ if((num.substr(0,1)=="0")){ num=num.substring(1) } else if((num.substr(0,1)=="1")){ strRet+=arr4[num.substr(1,2)] } else{ strRet+=arr2[num.substr(0,1)] if(num.substr(1,1)!="0")strRet+="-" num=num.substring(1) } } if((num.length==1)&&(num.substr(0,1)!="0")){ strRet+=arr3[num.substr(0,1)] } return strRet; } // --></script> </HEAD> <BODY> <input id=number value=1234567890><input type=button value=翻译成英文 onclick=alert(Translate(document.all.number.value))> </BODY> </HTML>
运行代码
相关阅读:
ejbca 无其他数据库支持情况下的安装
VC巨资注入开源软件产业 商业模式仍需摸索
EJBCA 3.0 开源CA系统软件初探
ejbca安装指南
Navicat for ORACLE 导出数据
cannot create oci environment/Navicat for oracle
EL表达式 (详解)
10个步骤让你成为高效的Web开发者
jquery.validationEngine+ajax验证
让您的 web 应用程序飞起来
原文地址:https://www.cnblogs.com/geass/p/1951484.html
最新文章
解决win7下netbeans安装的错误问题
JavaFX中Stage的resizable属性绑定不起作用
绝世神功
javacv——Java interface to OpenCV and more
LINQ 学习笔记3 Kevin
LINQ 学习笔记4 Kevin
LINQ 学习笔记2 Kevin
LINQ 学习笔记 Kevin
delphi中的过程和函数 Kevin
C# 中 Array,ArrayList和List的区别和联系 Kevin
热门文章
Lambad表达式树(转) Kevin
the first day of studying agile principles Kevin
LINQ 简介 Kevin
Delphi 函数指针 过程/函数类型 Kevin
软件商业模式的发展与SaaS
安装EJBCA步骤
EJBCA免费的CA证书管理中心
windows下ejbCA的安装和配置
转贴:ejbca技术探索
linux上部署ejbca
Copyright © 2020-2023
润新知