相關(guān)資訊
本類常用軟件
-
福建農(nóng)村信用社手機(jī)銀行客戶端下載下載量:584204
-
Windows優(yōu)化大師下載量:416896
-
90美女秀(視頻聊天軟件)下載量:366961
-
廣西農(nóng)村信用社手機(jī)銀行客戶端下載下載量:365699
-
快播手機(jī)版下載量:325855
每日一囧
下面提供給大家學(xué)習(xí)的是關(guān)于asp隨機(jī)圖片顯示的實(shí)例代碼分享,希望對大家有用。
<%@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 = Int((count*rnd)+1)
S = 0
ShowFileList = ""
For Each objFile in objFolder.Files
S = S + 1
If S = nume Then
ShowFileList = objFile.Name
Exit For
End If
Next
Set objFolder = Nothing
Else
ShowFileList = "NO"
End If
Set objFSO = Nothing
End Function
Dim list,filename,address,str
list = trim(Request.QueryString("list"))
if list = "" then
Response.write "本頁需要正確參數(shù)引入,您缺少相關(guān)的參數(shù)!正確格式如下:"&AllPath&"img.asp?list=圖片存放目錄"
Response.End()
end if
filename = ShowFileList("./"&list&"/")
if filename = "NO" then
Response.write "您指定的目錄<b>"&list&"</b>不存在,請重新指定!"
Response.End()
end if
if filename = "" then
Response.write "您指定的目錄<b>"&list&"</b>沒有相關(guān)的圖片文件存在,請重新指定!"
Response.End()
end if
str = right(filename,3)
if str<>"jpg" and str<>"gif" then
filename = "erro.gif"
end if
address = AllPath&list&"/"
address = address&filename
%>
<%Response.redirect(address)%>
<%
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 = Int((count*rnd)+1)
S = 0
ShowFileList = ""
For Each objFile in objFolder.Files
S = S + 1
If S = nume Then
ShowFileList = objFile.Name
Exit For
End If
Next
Set objFolder = Nothing
Else
ShowFileList = "NO"
End If
Set objFSO = Nothing
End Function
Dim list,filename,address,str
list = trim(Request.QueryString("list"))
if list = "" then
Response.write "本頁需要正確參數(shù)引入,您缺少相關(guān)的參數(shù)!正確格式如下:"&AllPath&"img.asp?list=圖片存放目錄"
Response.End()
end if
filename = ShowFileList("./"&list&"/")
if filename = "NO" then
Response.write "您指定的目錄<b>"&list&"</b>不存在,請重新指定!"
Response.End()
end if
if filename = "" then
Response.write "您指定的目錄<b>"&list&"</b>沒有相關(guān)的圖片文件存在,請重新指定!"
Response.End()
end if
str = right(filename,3)
if str<>"jpg" and str<>"gif" then
filename = "erro.gif"
end if
address = AllPath&list&"/"
address = address&filename
%>
<%Response.redirect(address)%>
熱門評論
最新評論