ASP 随机显示图片

来源:百度知道 编辑:UC知道 时间:2024/05/11 02:34:05
这是网上的一段代码,我不知道该怎么用,它那个参数我不知道怎么改
Response.write "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&AllPath&"img.asp?list=图片存放目录" 这句不知道怎么改!比如说我要把图片放在images/ 里面,怎么加?
全部代码如下:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Function AllPath()
Dim Domain,GFilePath
Domain = Request.ServerVariables("SERVER_NAME")
GFilePath = Request.ServerVariables("PATH_INFO")
GFilePath = lcase(left(GFilePath,instrRev(GFilePath,"/")))
AllPath = "http://"&Domain&GFilePath
End Function

Function ShowFileList(folderspec)
Dim Path,objFSO,objFolder,count,objFile,nume,S
Path = Server.MapPath(folderspec)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(Path) Then
Set objFolder = objFSO.GetFolder(Path)
count = 0
For Each objFile in objFolder.Files
count = count 1
Next
randomize
nume

在ASP文件里写一段随机输出的代码即可,如:

Dim strImage()
Dim i,intCount

Randomize
intCount = 10
ReDim strImage(intCount)
For i = 0 To intCount
strImage(i) = "http://www.baidu.com/images/" & i & ".gif"
Next

Response.write strImage(Int(Rnd * (intCount) + 1))