<%'开始分页
Const MaxPerPage=25
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
set rs=server.createobject("adodb.recordset")
rs.open "*",conn,1,1
if rs.eof And rs.bof then
Response.Write "<p align='center' class='in'> 您还没有添加活动!</p>"
else
totalPut=rs.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
showpage totalput,MaxPerPage,"pageList.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"这块是你当前页面的名称,比如page.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"这块是你当前页面的名称,比如page.asp"
end if
end if
end if
sub showContent
dim i
i=0
%>
<table class="tableBorder" width="98%" border="0" align="center" cellpadding="3" cellspacing="1" style=" margin-left:20px;">
<%do while not rs.eof
%>
<tr>
<td style="PADDING-LEFT: 6px;">• <a href="content.asp?id=<%=rs("*")%>" target=_blank style="color:#666666"><%=left(trim(rs("*")),20)%></a></td>
<td align="center" style="PADDING-LEFT: 6px;color:#999999"><%=rs("*")%></td>
</tr> <tr>
<td height="1" background="images/img_msjg_62.gif"></td>
<td background="images/img_msjg_62.gif"></td>
</tr>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
</table>
<%
End Sub
Function showpage(totalnumber,maxperpage,filename)
Dim n
If totalnumber Mod maxperpage=0 Then
n= totalnumber / maxperpage
Else
n= totalnumber / maxperpage+1
End If
Response.Write "<form method=Post action="&filename&">"
Response.Write "<p align='center' class='in'> "
If CurrentPage<2 Then
Response.Write "<font class='in'>首页 上一页</font> "
Else
Response.Write "<a href="&filename&"?page=1&classid="&classid&" class='in'>首页</a> "
Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&classid="&classid&" class='in'>上一页</a> "
End If
If n-currentpage<1 Then
Response.Write "<font class='in'>下一页 尾页</font>"
Else
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&classid="&classid&" class='in'>"
Response.Write "下一页</a> <a href="&filename&"?page="&n&"&classid="&classid&" class='in'>尾页</a>"
End If
Response.Write "<font class='in'> 页次:</font><font class='in'>"&CurrentPage&"</font><font class='in'>/"&n&"页</font> "
Response.Write "<font class='in'> 共有"&totalnumber&"条文章 "
Response.Write "<font class='in'>转到:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="¤tpage&">"
Response.Write " <input type='submit' value='GO' name='cndok'></form>"
End Function
%>