文章·资料 电脑软件 手机软件 网站源码




    本 站 搜 索
   推 荐 文 章        More...
华硕易电脑(ASUS Eee PC 10..
先来段开场白:为了外出携带方便..
Acronis True Image 使用..
  一款可以在Windows下使用..
Norton Ghost 使用详解
一、分区备份   使用Ghost..
    文 章 阅 读 排 行
世界各国所使用的国际域名..
域名缩写 国家/地区 ..
关于 Firefox 在中国持续..
亲爱的 Firefox 用户及 Firefox..
全国各地、公共 DNS 服务器
排序 地区/公司名称 ..
Microsoft SQL Server 2000..
  对于第一次安装 Microsoft ..
Windows 系统安装或备份时 ..
【ISO 文件】 ISO 文件其实..
Windows PE 系统安装微软..
如果电脑没有光驱,或者没有把..
ASP 网页编码 GB2312 转换..
1、用记事本打开文件(如果整站..
腾讯:难以承受之痛的背后..
亲爱的网吧管理员:   在此,..
SATA 硬盘分区设置与安装..
  随着i865、i875、KT600等..
Windows XP 安装界面修改..
安装装界面----也就是安装复制..
 文 章 信 息
金额大小写转换的ASP版
评论()〗〖留言〗〖收藏
〖文章分类:电脑·手机·网络 / 网站设计·开发·优化〗〖阅读选项
01 <form name= "form1" method= "post" action= "Submit.asp" >
02  <input type= "text" name= "page1num" >
03  <input type= "submit" name= "Submit" value= "提交" >
04 </form>
05 
06 ------以下是Submit.asp的代码---------
07 <%
08 dim tmpnum
09 '从第一张页面传过来的小写金额
10 tmpnum=request("page1num")
11 '调用并显示大写金额
12 response.write rmb(cdbl(tmpnum))
13 response.end
14 %>
15 <%
16 Function rmb(num)
17 num = FormatNumber(num, 2)
18 dim numList
19 dim rmbList
20 dim numLen
21 dim numChar
22 dim numstr
23 dim n
24 dim n1, n2
25 dim hz
26 numList = "零壹贰叁肆伍陆柒捌玖"
27 rmbList = "分角元拾佰仟万拾佰仟亿拾佰仟万"
28 If num > 9999999999999.99 Then
29  rmb = "超出范围的人民币值"
30  Exit Function
31 End If
32 
33 numstr = CStr(num * 100)
34 numLen = Len(numstr)
35 n = 1
36 Do While n <= numLen
37  numChar = CInt(Mid(numstr, n, 1))
38  n1 = Mid(numList, numChar + 1, 1)
39  n2 = Mid(rmbList, numLen - n + 1, 1)
40  If Not n1 = "零" Then
41  hz = hz + CStr(n1) + CStr(n2)
42  Else
43  If n2 = "亿" Or n2 = "万" Or n2 = "元" Or n1 = "零" Then
44  Do While Right(hz, 1) = "零"
45  hz = Left(hz, Len(hz) - 1)
46  Loop
47  End If
48  If (n2 = "亿" Or (n2 = "万" And Right(hz, 1) <> "亿" ) Or n2 = "元") Then
49  hz = hz + CStr(n2)
50  Else
51  If Left(Right(hz, 2), 1) = "零" Or Right(hz, 1) <> "亿" Then
52  hz = hz + n1
53  End If
54  End If
55  End If
56  n = n + 1
57 Loop
58 Do While Right(hz, 1) = "零"
59  hz = Left(hz, Len(hz) - 1)
60 Loop
61 If Right(hz, 1) = "元" Then
62  hz = hz + "整"
63 End If
64 rmb = hz
65 End Function
66 %>

文章作者:未知  更新日期:2008-03-07
〖文章浏览:〗〖发送文章〗〖打印文章