南宁做保安亭厂家:百度贴吧里边有回复一次变一次的图片,这是什么原理啊?

来源:百度文库 编辑:神马品牌网 时间:2024/05/06 06:42:48
还有,应该怎么制作?

就是利用刷新一次换一次图片的原理。因为回复后页面都会自动刷新。大家先把鼠标放到图片上点右键,点属性,可以看到联接并不是一张图片,而是一个联接到asp页面的链接。

下面是asp源代码
************************* 随机图片显示 ****************************
'使用实例:img.asp?list=图片存放目录
'使用注意:图片目录放于本文件同目录下!需要FSO支持!
'说明:只要将变化图片放于一个目录下,修改下面程序的(需要修改的地方)成你的目录名称!
上传本程序和图片文件夹到同一目录下,在发帖时候使用UBB代码形如:即可!
'----------------------------------------------------------------------------------------
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,2004528115924.htm,address,str

list = trim(Request.QueryString("list"))
if list = "" then
Response.write "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&AllPath&"img.asp?list=(需要修改的地方)"
Response.End()
end if

2004528115924.htm = ShowFileList("./"&list&"/")
if 2004528115924.htm = "NO" then
Response.write "您指定的目录<b>"&list&"</b>不存在,请重新指定!"
Response.End()
end if

if 2004528115924.htm = "" then
Response.write "您指定的目录<b>"&list&"</b>没有相关的图片文件存在,请重新指定!"
Response.End()
end if

str = right(2004528115924.htm,3)
if str<>"jpg" and str<>"gif" then
2004528115924.htm = "erro.gif"
end if

address = AllPath&list&"/"
address = address&2004528115924.htm
%>
<%Response.redirect(address)%>

其实并不需要回复,刷新一次就可以变。

你右键点击那些图片,查看属性。 你会发现,那个链接并不是一般的图片地址,而是指向一个ASP页面,后面一般带了参数。
例如:http://www.54321mm.com/meinv/img.asp?list=mm.jpg
指向img.asp这个页面“?”后面的就是参数。
就是利用这个ASP页面中的"随机函数"实现的。

如果你有一定的编程基础,那么要实现这样的功能只需简单思考就会有办法。

要自己制作随机图片,需要有自己的主页空间(空间支持ASP)。必须在自己的主页空间上编写一个ASP网页,然后存放一些自己选择的图片。最后把你的ASP网页地址按照上面的形式贴到贴吧上。

你若不想自己做,也可以将就别人的代码。找一个这样的图片,右键查看它的属性,把它的地址复制下来,贴到别的地方就可以了。

如果你有心自己做,下面转摘一段ASP源码。

************************* 随机图片显示 ****************************
’使用实例:img.asp?list=图片存放目录
’使用注意:图片目录放于本文件同目录下!需要FSO支持!
’说明:只要将变化图片放于一个目录下,修改下面程序的(需要修改的地方)成你的目录名称!
上传本程序和图片文件夹到同一目录下,在发帖时候使用UBB代码形如:即可!
’----------------------------------------------------------------------------------------
<%
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,2004528115924.htm,address,str

list = trim(Request.QueryString("list"))
if list = "" then
Response.write "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&AllPath&"img.asp?list=(需要修改的地方)"
Response.End()
end if

2004528115924.htm = ShowFileList("./"&list&"/")
if 2004528115924.htm = "NO" then
Response.write "您指定的目录"&list&"不存在,请重新指定!"
Response.End()
end if

if 2004528115924.htm = "" then
Response.write "您指定的目录"&list&"没有相关的图片文件存在,请重新指定!"
Response.End()
end if

str = right(2004528115924.htm,3)
if str<>"jpg" and str<>"gif" then
2004528115924.htm = "erro.gif"
end if

address = AllPath&list&"/"
address = address&2004528115924.htm
%>

出自用户名:ttq168
笔名:须眉浊物

在网页加上随机功能 随机显示的是图片