分页不管用,哪里错了呀,谁帮忙看看
代码如下:
<table width="700" border="0" cellpadding="0" cellspacing="0" background="images/mh_bg005.gif">
<tr>
<td width="140">
<%
PageShowSize = 5 '每页显示多少个页
MyPageSize = 10 '每页显示多少条文章
If Not IsNumeric(Request("page")) Or IsEmpty(Request("page")) Or Request("page") <=0 Then
MyPage=1
Else
MyPage=Int(Abs(Request("page")))
End if
set rs=server.createobject("adodb.recordset")
sql="select picname from news where typeid=4 and checkked=1 order by newsID desc"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
%>
<table width="700" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="140"><table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee">暂无图片</td>
</tr>
</table></td>
</tr>
</table>
<%
else
rs.PageSize = MyPageSize
MaxPages = rs.PageCount
rs.absolutepage = MyPage
total = rs.RecordCount
i = 1
%>
<table width="700" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="700" border="0" cellpadding="0" cellspacing="0">
<%
for i=1 to rs.recordcount
%>
<tr>
<td width="140" height="166"><div align="center">
<table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee"><a href=zbzs_001.asp?id=<%=rs("newsid")%> target=_blank><img src="uploadfile/<%=rs("picname")%>" width="100" height="130" border="0" /></a></td>
</tr>
</table>
</div>
</td>
<%
rs.movenext
if rs.eof then exit for
%>
<td width="140"><div align="center">
<table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee"><a href=zbzs_001.asp?id=<%=rs("newsid")%> target=_blank><img src="uploadfile/<%=rs("picname")%>" width="100" height="130" border="0" /></a></td>
</tr>
</table>
</div></td>
<%
rs.movenext
if rs.eof then exit for
%>
<td width="140"><div align="center">
<table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee"><a href=zbzs_001.asp?id=<%=rs("newsid")%> target=_blank><img src="uploadfile/<%=rs("picname")%>" width="100" height="130" border="0" /></a></td>
</tr>
</table>
</div></td>
<%
rs.movenext
if rs.eof then exit for
%>
<td width="140"><div align="center">
<table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee"><a href=zbzs_001.asp?id=<%=rs("newsid")%> target=_blank><img src="uploadfile/<%=rs("picname")%>" width="100" height="130" border="0" /></a></td>
</tr>
</table>
</div></td>
<%
rs.movenext
if rs.eof then exit for
%>
<td width="140"><div align="center">
<table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee"><a href=zbzs_001.asp?id=<%=rs("newsid")%> target=_blank><img src="uploadfile/<%=rs("picname")%>" width="100" height="130" border="0" /></a></td>
</tr>
</table>
</div></td>
</tr>
</table>
<%
rs.movenext
if rs.eof then exit for
next
%>
<table width="700" border="0" cellspacing="1" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td bgcolor="#EEEEEE" height="22"><div align="right">共 <%=total%> 条,当前第 <%=Mypage%>/<%=Maxpages%>页,每页 <%=MyPageSize%> 条
<%
url="zbzs.asp?"
PageNextSize=int((MyPage-1)/PageShowSize)+1
Pagetpage=int((total-1)/rs.PageSize)+1
if MyPage-1 > 0 then
Prev_Page = MyPage - 1
Response.write "<a class=black href='" & Url & "page=" & Prev_Page & "' title='第" & Prev_Page & "页'>上一页</a> "
end if
if Maxpages>=PageNextSize*PageShowSize then
PageSizeShow = PageShowSize
Else
PageSizeShow = Maxpages-PageShowSize*(PageNextSize-1)
End if
If PageSizeShow < 1 Then PageSizeShow = 1
for PageCounterSize=1 to PageSizeShow
PageLink = (PageCounterSize+PageNextSize*PageShowSize)-PageShowSize
if PageLink <> MyPage Then
Response.write "<a class=black href='" & Url & "page=" & PageLink & "'>[" & PageLink & "]</a> "
else
Response.Write "<B>["& PageLink &"]</B> "
end if
If PageLink = MaxPages Then Exit for
Next
if Mypage+1 <=Pagetpage then
Next_Page = MyPage + 1
Response.write "<a class=black href='" & Url & "page=" & Next_Page & "' title='第" & Next_Page & "页'>下一页</A>"
end if
if MaxPages > PageShowSize*PageNextSize then
PageNext = PageShowSize * PageNextSize + 1
Response.write " <A class=black href='" & Url & "page=" & Pagetpage & "' title='第"& Pagetpage &"页'>页尾</A>"
End if
%>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
<%
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</td>
</tr>
</table>