<%
sql="Select * from [Bkye_article] order by id desc"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
page=cint(request("page"))
n=rs.RecordCount
PageSize=2
rs.pagesize=PageSize
m=cint(rs.pagecount)
if page="" then
page=1
elseif page<1 then
page=1
end if
if cint(request("page"))>m then
page=m
end if
page=cint(page)
if not rs.eof then
rs.absolutepage=page
end if
if m>page+5 then
endpage=page+5
else
endpage=m
end if
'if page>1 then
'pagetitle=pagetitle & " " & "[" & "<a href=asp.asp?page=" & i & ">上十页 <a>" & "]"
'end if
for i=page-4 to endpage
if not i<1 then
if i = page then
pagetitle=pagetitle & " " & "<B>[" & i & "]</B>"
else
pagetitle=pagetitle & " " & "[" & "<a href=asp.asp?page=" & i & ">" & i & "<a>" & "]"
end if
end if
next
if page+3 < m then
pagetitle=pagetitle & " " & "[" & "<a href=asp.asp?page=" & i+4 & ">下十页 <a>" & "]"
end if
%>
<%
i=0 j=0
Do While Not rs.Eof And i<PageSize
i = i + 1
'j=j+1
%>
<div>
<a href="article.asp?id=<%=rs("id")%>"><%=rs("Title")%></a>
</div><br><br>
<%
rs.MoveNext
loop
%>
<%=pagetitle%>