当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP实例学习:随机生成文件名的函数

ASP
asp搜索两个以上的词的原理
如何使用花生壳?
asp汉字转换成汉语拼音代码
asp程序实现伪静态的代码
asp处理xml数据的发送、接收类
ASP中使用jmail发送邮件的函数
asp中获取字符串中的时间字符串
ASP按照字数限制自动截取标题内容
asp中将内容生成word文档的函数
用ASP自动清空IE缓存里的内容
asp检测conn.execute是否执行成功的函数
自动获取当前页面URL的ASP函数
ASP采集中获取网页内所需的html代码
asp图片采集并且本地重命名保存的函数
如何使用asp去字符串中的超链接
asp网站通过限制请求防止被采集的函数
asp利用正则去掉字符串中所有html内容
用ASP取出HTML里面的图片地址的函数
fso实现整个文件夹内容的复制到另一个文件夹中
适合所有表的添加、删除、修改的函数

ASP实例学习:随机生成文件名的函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 70 ::
收藏到网摘: n/a

 

以下为引用的内容:

<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>