循环多出一列
共8条记录
8 7 6
5 4 3
2 1
但我下面这个是
8 7 6
5 4 3
3 2 1 //此处多个3不知道哪里错了
<!--#include file= "inc/conn.asp "-->
<%
set rs1=server.createobject( "adodb.recordset ")
sql1= "select * from honor order by id desc "
rs1.open sql1,conn,1,1
const MaxPerPage=5 '分页显示的纪录个数
dim sql
dim rs
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
if not isempty(request( "page ")) then
currentPage=cint(request( "page "))
else
currentPage=1
end if
totalPut=rs1.recordcount
if currentpage <1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage> totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpages totalput,MaxPerPage
else
if (currentPage-1)*MaxPerPage <totalPut then
rs1.move (currentPage-1)*MaxPerPage
showContent
showpages totalput,MaxPerPage
else
currentPage=1
showContent
showpages totalput,MaxPerPage
end if
end if
sub showContent
%>
<table width= "100% " align= "center " valign= "middle " height= "100% ">
<tr>
<%
i=0
do while not rs1.eof
%>
<td align= "center " width= "33% "> <Table> <tr> <td>
<a href= "连接地址 " target= "_blank "> <img src= "记录的图片路径如:> <%=rs1( "img ")%> " alt= "图片说明,可不填,如: <%=rs1( "title ")%> " width= "110 " height= "143 " border= "0 "> </a>
</td>
</tr>
<tr> <td align= "center "> <%=rs1( "title ")%> --> 图片标题
</td> </tr> </Table> </td>
<%
rs1.movenext
i=i+1
if i mod 3=0 then
%>
</tr> <tr>
<%
end if
if i> MaxPerPage then exit do
loop
%> </tr>
<tr> <td> </td> </tr> </table>
<%
rs1.close '释放资源
set rs1=nothing
end sub
Function showpages(totalPut,MaxPerPage)
dim n
if (totalPut mod MaxPerPage)=0 then
n= totalPut \ MaxPer