图片如何分页显示

xifang 2003-10-19 01:36:04
请问各位大侠图片如何分页显示
我做出来得每行只能显示一张图片
不知道怎么才能够每行显示固定数量图片
然后再分页显示
谢谢各位
...全文
316 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
一亩三分地__ 2003-10-19
  • 打赏
  • 举报
回复
你看看把,这是分页的源码。。。
一亩三分地__ 2003-10-19
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<!--#include file="session.asp" -->


<%
Sub LastNextPage(pagecount,page,resultcount)
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")

query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next

Response.Write("<table cellspacing=0 cellpadding=0 border=0>" & vbCrLf )
Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
Response.Write("<TD align=right>" & vbCrLf )
' Response.Write(font_style & vbCrLf )

if page<=1 then
Response.Write ("首页 " & vbCrLf)
Response.Write ("上一页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上一页</A> " & vbCrLf)
end if

if page>=pagecount then
Response.Write ("下一页 " & vbCrLf)
Response.Write ("尾页" & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下一页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">尾页</A>" & vbCrLf)
end if

Response.Write(" 第" & "<INPUT style=""HEIGHT: 19px;font-size: 12px""TYEP=TEXT NAME=page SIZE=2 Maxlength=5 VALUE=" & page & ">" & "页" & vbCrLf & "<INPUT type=submit style=""HEIGHT: 19px;font-size: 12px"" value=GO>")
Response.Write(" 共 " & pageCount & " 页" & vbCrLf)
Response.Write(" " & resultcount & " 张" & vbCrLf)
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub


set rs=server.CreateObject("adodb.recordset")
sql="select photo.*,user.realname,user.username from photo,[user] where user.username=photo.photouser and photopro=1 order by phototime desc"
rs.open sql,conn,1,1
if not rs.eof then
rs.PageSize =5 '每页记录条数
result_num=rs.RecordCount '记录总数
maxpage=rs.PageCount
page=request("page")

if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if

if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if

rs.AbsolutePage=Page

else
result_num=0
maxpage=0
page=0
end if
formPath="upload"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>五零组合ぷ——五零试图</title>
<link href="css/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="2">
<table width="778" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333">
<tr>
<td height="30" align="right" background="images/pot.gif">设为首页 | 加入收藏 | 联系我们   </td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF"> <div align="center"><img src="images/banner2.GIF" width="778" height="142"></div></td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" background="images/pot.gif">
<tr>
<td width="200" height="255" valign="top" bgcolor="#FFFFFF"> <!--#include file="right.asp" --> </td>
<td width="579" colspan="3" valign="top" bgcolor="#FFFFFF"> <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" background="images/pot.gif">
<tr>
<td bgcolor="#FFFFFF"><table border="0" cellpadding="2" width="100%">
<tr>
<td>你的位置>五零试图>班级公开像册</td>
<td> <p align="right"><img src="images/doc_more1.gif" width="11" height="11"><a href="photoadd.asp">上传相片</a></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<%
if not rs.eof then
i=1
for i=1 to rs.PageSize

%>
<tr>
<td colspan="2" background="images/pot.gif"> </td>
</tr>
<tr>
<td width="42%"><div align="center"><a href="photoview.asp?id=<%=rs("photoid")%>"><img src="<%=formPath%>/<%=rs("photoname")%>" width="130" border="0"></a></div></td>
<td width="58%"> 标题:<%=trim(rs("phototitle"))%><br>
上传人:<%=trim(rs("realname"))%><br>
相册等级:公开(即所有班级成员均可浏览)<br>
上传时间:<%=trim(rs("phototime"))%><br>
图片介绍: <%=trim(rs("photocomment"))%></td>
</tr>
<%rs.movenext:if rs.EOF then Exit For
next

end if
rs.close
set rs=nothing
%>
<tr bgcolor="#F3F3F3">
<td height="25" colspan="2"> <div align="center">
<% call LastNextPage(maxpage,page,result_num) %>
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="30" colspan="4"> <div align="center">Copyright © 徐州师范大学计科02(4)班.All
rights resvered.</div></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<%
conn.close
set conn=nothing
%>
feel8 2003-10-19
  • 打赏
  • 举报
回复
用循环,每输出三张图片后再输出一个<br>来换行。
goldme76 2003-10-19
  • 打赏
  • 举报
回复
用表格啊,一个单位格里放一张图片啊,你要一行显示三张图片,就用一个一行三列的表格

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧