<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from sightn where 1=1 "&tj1&" "&tj2&" and 1=1 order by toporder,id",conn,1,1
if rs.recordcount=0 then
else
rs.PageSize =24 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
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
rs2news.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
For i=1 To x
<% call PageControl(iCount,maxpage,page,"border=0 align=right","")
rs2news.close
set rs2news=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
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
if page<=1 then
Response.Write "<li>|<上一页</li> "
else
Response.Write"<li><A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">|<上一页</A></li> "
end if
for ii=1 to pageCount
if page=ii then
Response.Write"<li class='now'>"&ii&"</a></li>"
else
Response.Write"<li><A HREF=" & action & "?" & temp & "Page=" & (ii) & ">"&ii&"</a></li>"
end if
next
if page>=pagecount then
Response.Write "<li>下页>|</li> "
else
Response.Write "<li><A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下页>|</A></li> "
end if
%></ul>
共计<%=iCount%>条,共<%=pageCount%>页,每页<%=iPageSize%>
当年话下
相关分类