类似的图片预览功能,asp代码应该如何写,能给出一个大概的代码吗?(及时结贴)

zftnt 湖南农创现代农业有限公司 运维工程师  2004-08-04 09:37:47
http://mir3.17173.com/picsent/

如上面网页的那种效果,四行三列的显示固定尺寸的小图,点击小图后显示大图片,这样的效果用asp如何实现?在线等,及时结贴给分。
...全文
107 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
zftnt 2004-08-04
好啊,多谢几位朋友的代码,我马上测试,完了就来结贴给分
回复
浩飞__ 2004-08-04
呵呵,我的简单
回复
浩飞__ 2004-08-04
<%
set rs=conn.execute("select * from 表名 order by id desc")
do while not rs.eof
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<%
for i=1 to 4
on error resume next
if not (rs.bof and rs.eof) then
%>
<td><a href="<%=rs("保存图片路径的字段")%>" target="_blank"><img src="<%=rs("保存图片路径的字段")%>" width="图片宽" height="图片宽高" border="0"></a></td>
<%
end if
rs.movenext
if rs.bof or rs.eof then exit do
next
%>
</tr>
</table>
<%loop%>
回复
dfmz007 2004-08-04
<%
dim classname,typeid,typename
if IsNumeric(Request.QueryString("id"))=False then
Response.Redirect"info.asp?info=错误的参数"
else
id=cint(Request.QueryString("id"))
end if
set temprs=conn.execute("select typeid,classid,name from desktop where id="&id)
typeid=temprs(0)
filename=temprs(2)
classname=temprs(0)
set temprs=nothing
set temprs=conn.execute("select name from type where id="&typeid)
typename=temprs(0)
set temprs=nothing
%>
<title> <%=typename%> >> <%=filename%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="<%=bgcolor%>" text="#000000">

<table width="774" height="25" border="0" align="center" cellpadding="3" cellspacing="0" class="xzy">
<tr>
<td bgcolor="<%=titlecolor%>"><a href="index.asp">返回首页</a>
<%
sql = "SELECT * FROM type ORDER BY id DESC"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.OPEN sql,Conn,0,1
if rs.eof and rs.bof then
Response.Write"还没有分类"
else
do while not rs.eof
Response.Write"| <a href='type.asp?typeid="&rs("id")&"'>"&rs("name")&"</a>"
rs.movenext
loop
end if
rs.close
Set rs=Nothing
%>
</td>
</tr>
</table>
<table width="774" border="0" align="center" cellpadding="3" cellspacing="0" class="xzy">
<tr>
<td bgcolor="#FFFFFF">
<%Response.Write "您当前的位置:<a href='type.asp?typeid="&typeid&"'>"&typename&"</a> - "&filename%>
</td>
</tr>
</table>
<table width="774" border="0" cellspacing="00" cellpadding="0" align="center">
<tr>
<td background="images/xc_4_bj.jpg">
<%
sql = "SELECT * FROM desktop where id="&id
Set rs = Server.CreateObject("ADODB.Recordset")
rs.OPEN sql,Conn,1,3
rs("ck")=rs("ck")+1
rs.update
if rs("lx")=1 then
Response.Write"<table width='100%' border='0' cellspacing='0' cellpadding='5' align='center'><tr><td align='center'><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='550' height='400'><param name=movie value='"&rs("pic")&"'><param name=quality value=high><embed src='"&rs("pic")&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='550' height='400'></embed></object></td></tr></table>"
elseif rs("lx")=0 then
Response.Write"<table width='100%' border='0' cellspacing='0' cellpadding='5' align='center'><tr><td align='center'><table align=center bgcolor='#e9e9e9' border=0 cellpadding=5 cellspacing=0 class='bk1'><tbody><td><img src='"&rs("pic")&"' align='center'></td></tbody></table></td></tr></table>"
end if

Response.Write"<table width='750' border='0' cellspacing='0' cellpadding='3' class='bk' align='center'><tr><td width='720'>文件名称:"&rs("name")&" | 察看次数:"&rS("ck")&" | 添加时间:"&rs("time")&"<br>文件简介:"&rs("jj")&"</td>"
if rs("url")<>"" then
Response.Write"<td width='30' class='z'><a href='"&rs("url")&"'>打 包<br>下 载</a>"
end if
Response.Write"</tr></table>"
rs.close
Set rs=Nothing
conn.close
Set conn=Nothing
%>
这是点击放大后的代码..呵呵
回复
dfmz007 2004-08-04
<%
Response.Write"<table width='100%' border='0' cellspacing='0' cellpadding='5'>"

Dim ipagecount
Dim ipagecurrent
Dim strorderBy
Dim irecordsshown
if request.querystring("page")="" then
ipagecurrent=1
else
ipagecurrent=cint(request.querystring("page"))
end if

if key<>"" then
sql = "SELECT minipic,ck,name,id FROM desktop where name like '%"&key&"%' ORDER BY id DESC"
else
sql = "SELECT minipic,ck,name,id FROM desktop ORDER BY id DESC"
end if
Set rs = Server.CreateObject("ADODB.Recordset")
rs.pagesize = 9
rs.cachesize = 9
rs.open sql,conn,1,1
ipagecount = rs.pagecount
If ipagecurrent > ipagecount Then ipagecurrent = ipagecount
If ipagecurrent < 1 Then ipagecurrent = 1
if ipagecount=0 then
response.write "<tr><td align='center'>没有任何文件</tr></td>"
else
rs.absolutepage = ipagecurrent
irecordsshown = 0
do while irecordsshown<9 and NOT rs.EOF
Response.Write"<tr align='center'>"

for i=1 to 3

Response.Write"<td width='33%'>"
if not rs.eof then
Response.Write"<table align=center bgcolor='#e9e9e9' border=0 cellpadding=5 cellspacing=0 class='bk1'><tbody><td><a href='display.asp?id="&rs("id")&"' target='_blank'><img src='"&rs("minipic")&"' border='0' width=141 height=141 class='bk'></a></td></tbody></table><br><a href='display.asp?id="&rs("id")&"' target='_blank'>"&rs("name")&"</a> </td>"
irecordsshown = irecordsshown +1
rs.movenext
end if

next

Response.Write"</tr>"
loop
end if
rs.Close
set rs=nothing
Response.Write"</table>"

Response.Write"<table width='100%' border='0' cellspacing='0' cellpadding='5' class='s'><form name='form1' method='get' action='5.asp'><tr><td height='20' align='center'>每页显示 9 个文件 共有 "&ipagecount&" 页 当前为第 "&ipagecurrent&" 页 "
if ipagecurrent=1 then
Response.Write"首页 | "
else
Response.Write"<a href='5.asp?key="&key&"&page=1'>首页</a> | "
end if
if ipagecurrent=1 then
Response.Write"上一页 | "
else
Response.Write"<a href='5.asp?key="&key&"&page="&ipagecurrent-1&"'>上一页</a> | "
end if
if ipagecount>ipagecurrent then
Response.Write"<a href='5.asp?key="&key&"&page="&ipagecurrent+1&"'>下一页</a> "
else
Response.Write"下一页"
end if
if ipagecount>ipagecurrent then
Response.Write"| <a href='5.asp?key="&key&"&page="&ipagecount&"'>末页</a> "
else
Response.Write"| 末页 "
end if
Response.Write"</td></tr></form></table>"
%>
你去参考着做一下吧..^_^
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-08-04 09:37
社区公告
暂无公告