最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442
当前位置:首页 > 编程开发 > asp教程

ASP随机生成汉字技巧

日期:02-04    来源:网页设计秀    作者:cnwebshow.com

<%Dim ijLu中国设计秀
    Dim jjLu中国设计秀
    Dim HSjLu中国设计秀
    Dim HEjLu中国设计秀
    Dim LSjLu中国设计秀
    Dim LEjLu中国设计秀
    dim ResultjLu中国设计秀
    Result=""jLu中国设计秀
    HS = 177jLu中国设计秀
    HE = 247jLu中国设计秀
    LS = 161jLu中国设计秀
    LE = 254jLu中国设计秀
    dim Max_NumjLu中国设计秀
    Max_num=65536jLu中国设计秀
    Randomize   jLu中国设计秀
    For i = 1 To 4 jLu中国设计秀
temp1=dec2bin(Int((HE - HS) * Rnd()) + HS) jLu中国设计秀
temp2=dec2bin(Int((LE - LS) * Rnd()) + LS) jLu中国设计秀
        Result = Result & chr(BinaryToDecimal(temp1 & temp2) - Max_num)jLu中国设计秀

    NextjLu中国设计秀
    response.write Result & " "jLu中国设计秀
%>jLu中国设计秀
<%jLu中国设计秀
    ''下面是函数jLu中国设计秀
''-------------------------------------------jLu中国设计秀
Public Function dec2bin(mynum)''十进制到二进制jLu中国设计秀
Dim loopcounter jLu中国设计秀
If mynum >= 2 ^ 31 ThenjLu中国设计秀
dec2bin = "Too big"jLu中国设计秀
Exit FunctionjLu中国设计秀
End IfjLu中国设计秀
DojLu中国设计秀
If (mynum And 2 ^ loopcounter) = 2 ^ loopcounter ThenjLu中国设计秀
dec2bin = "1" & dec2binjLu中国设计秀
ElsejLu中国设计秀
dec2bin = "0" & dec2binjLu中国设计秀
End IfjLu中国设计秀
loopcounter = loopcounter + 1jLu中国设计秀
Loop Until 2 ^ loopcounter > mynumjLu中国设计秀
End FunctionjLu中国设计秀
''-------------------------------------------jLu中国设计秀
Public Function BinaryToDecimal(BinaryValue) ''二进制到十进制的转换jLu中国设计秀
'' Returns the decimal equivalent of a binary numberjLu中国设计秀
Dim idxjLu中国设计秀
Dim tmpjLu中国设计秀
Dim resultjLu中国设计秀
Dim digitsjLu中国设计秀
digits = Len(BinaryValue)jLu中国设计秀
For idx = digits To 1 Step -1    jLu中国设计秀
    tmp = Mid(BinaryValue, idx, 1)jLu中国设计秀
    If tmp = "1" Then result = result + 2 ^ (digits - idx)jLu中国设计秀
NextjLu中国设计秀
BinaryToDecimal = resultjLu中国设计秀

End Function jLu中国设计秀
%>jLu中国设计秀

本文引用地址:/bc/article_46242.html
网站地图 | 关于我们 | 联系我们 | 网站建设 | 广告服务 | 版权声明 | 免责声明