<%response.Charset="gb2312"%>
<script language=javascript>
function go(page,order,field){
if(page!=""){
location.href="?topage="+page+"&order="+order+"&field="+field
}
else{
alert("请输入页数!");
}
}
</script>
<!--#include file="conn.asp"-->
<%
set rs=server.CreateObject("Adodb.recordset")
if request("order")="" and request("field")="" then
sql="Select * from info order by id desc"
elseif request("order")<>"" and request("field")<>"" then
sql="Select * from info order by " &request("field") &" " & request("order")
end if
'response.write sql
'response.end
rs.open sql,cn,1,2
rs.pagesize=8
if not isempty(request("topage")) and isnumeric(request("topage")) then
topage=cint(request("topage"))
if topage >= rs.pagecount then
' response.write sql
rs.absolutepage=rs.pagecount
elseif topage <=0 then
rs.absolutepage =1
else
rs.absolutepage=topage
end if
end if
intcurpage=rs.absolutepage
%>
<table width="80%" border="1" align="center" cellpadding="0" cellspacing="0" style="font-size:12px;font-family:Arial, Helvetica, sans-serif;">
<tr>
<td width="19%" height="24">
<%if request("order")="asc" then%>
<a href="?order=desc&field=id">编号</a>
<%else%>
<a href="?order=asc&field=id">编号</a>
<%end if%>
</td>
<td width="44%" height="24">标题</td>
<td width="37%" height="24">
<%if request("order")="asc" then%>
<a href="?order=desc&field=datetime">日期</a>
<%else%>
<a href="?order=asc&field=datetime">日期</a>
<%end if%>
</td>
</tr>
<%
for i=1 to rs.pagesize
if rs.eof then
exit for
end if
%>
<Tr>
<td height="24"><%=rs("id")%></td>
<Td height="24"><%=rs("title")%></Td>
<Td height="24"><%=rs("datetime")%></Td>
</Tr>
<%
rs.movenext
next
%>
<tr>
<Td colspan="3" align="center">
<%if rs.pagecount<>1 then%>
<form name=myform action="" method="post" style="margin:0px;">
<% if topage=1 or request("topage")="" then %>
[首页] [上一页]
<% Else %>
[<a href="?topage=1&order=<%=request("order")%>&field=<%=request("field")%>">首页</a>] [<a href="?topage=<%=intcurpage-1%>&order=<%=request("order")%>&field=<%=request("field")%>">上一页</a>]
<% End If %>
<% if topage=rs.pagecount then %>
[下一页] [尾页]
<% Else %>
[<a href="?topage=<%=intcurpage+1%>&order=<%=request("order")%>&field=<%=request("field")%>">下一页</a>]
[<a href="?topage=<%=rs.pagecount%>&order=<%=request("order")%>&field=<%=request("field")%>">尾页</a>]
<% End If %>
当前:<%if intcurpage=-1 then%>0<%else%><%=intcurpage%><%end if%>/<%=rs.pagecount%>页 共有:<%=rs.recordcount%>条 <input type=text style="width:20px;" name=topage id=topage /> <input type=button value=GO name=smt onclick="go(document.getElementById('topage').value,'<%=request("order")%>','<%=request("field")%>')"></form>
<%else%>
[首页] [上一页]
[下一页] [尾页]
当前:<%if intcurpage=-1 then%>0<%else%><%=intcurpage%><%end if%>/<%=rs.pagecount%>页 共有:<%=rs.recordcount%>条
<%end if%>
<%
rs.close
set rs=nothing
cn.close
set cn=nothing
%>
</Td>
</tr>
</table>