刷新一次,图片就变一张的修改

百变图大家都知道吧,前2年可是吸引眼球哟,当然你可以做成百变美女等等啦,这个原理一样,论坛顶部广告刷新一次就变一张的方法,举例说明,共分如下5步:

1.先得多找几张顶部广告图 最好gif或者jpg格式,然后放到一个文件夹里,比如取名是2secp

2.然后再建一个文件夹,比如名字是secp,把2secp放到secp里

3.另外把xing.asp文件也放到secp文件夹里,不是2secp里哟

4.做完前3步,就可以把secp文件夹上传到论坛空间根目录下啦

5.最后到后台用下面的代码替换“首页顶部广告”里的代码:
<a href=http://www.netton.cn target="_blank"><img src=xing.asp?list=图片文件夹 width=470 height=60 border=0></a>

注:其中的网址换成你的,图片的宽度&高度自己看着改哟~

以下为xing.asp内容

<%@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 "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&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>没有相关的图片文件存在,请重新指定!"
   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)%>