ASP实例学习:随机生成文件名的函数
来源: 阅读:1100 次 日期:2014-09-19 10:52:08
温馨提示: 小编为您整理了“ASP实例学习:随机生成文件名的函数”,方便广大网友查阅!

<html>

<meta http-equiv="Refresh" content="2">

<!--

 Place this code into an ASP Page and run it!

-->

<code>

Random FileName Creation

<%

 Function Generator(Length)

dim i, tempS, v

dim c(39)

tempS = ""

c(1) = "a": c(2) = "b": c(3) = "c": c(4) = "d": c(5) = "e": c(6) = "f": c(7) = "g"

c(8) = "h": c(9) = "i": c(10) = "j": c(11) = "k": c(12) = "l": c(13) = "m": c(14) = "n"

c(15) = "o": c(16) = "p": c(17) = "q": c(18) = "r": c(19) = "s": c(20) = "t": c(21) = "u"

c(22) = "v": c(23) = "w": c(24) = "x": c(25) = "y": c(26) = "z": c(27) = "1": c(28) = "2"

c(29) = "3": c(30) = "4": c(31) = "5": c(32) = "6": c(33) = "7": c(34) = "8": c(35) = "9"

c(36) = "-": c(37) = "_": c(38) = "@": c(39) = "!"

If isNumeric(Length) = False Then

 Response.Write "A numeric datatype was not submitted to this function."

 Exit Function

End If

For i = 1 to Length

 Randomize

 v = Int((39 * Rnd) + 1)

 tempS = tempS & c(v)

Next

Generator = tempS

 End Function

 For i = 1 to 20

Randomize

x = Int((20 * Rnd) + 1) + 10

Response.Write Generator(x) & "<br>" & vbnewline

 Next

%>

</code>

更多信息请查看IT技术专栏

更多信息请查看网络编程
由于各方面情况的不断调整与变化, 提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!

2025国考·省考课程试听报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 云南省教育厅备案号:云教ICP备0901021 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:
咨询QQ:526150442(9:00—18:00)版权所有:
云南网警报警专用图标
Baidu
map