当前位置:编程学习 > asp >>

asp 生成任意英文+数字位数长度的随机码函数

答案: <%
'******************************
'函数:Generator(Length)
'参数:Length,任意长度的数值,随机码位数
'作者:阿里西西
'日期:2007/7/15
'描述:生成任意英文+数字位数长度的随机码函数
'示例:Generator(80)
'******************************
Function Generator(Length)
Dim i, tempS
tempS = "abcdefghijklmnopqrstuvwxyz1234567890"
Generator = ""
If isNumeric(Length) = False Then
Exit Function
End If
For i = 1 to Length
Randomize
Generator = Generator & Mid(tempS,Int((Len(tempS) * Rnd) + 1),1)
Next
End Function
%>

上一个:在VBScript中实现-函数/方法名作为参数传入另一个函数
下一个:XDOWNPAGE ASP版本 分页类

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,