<!--查询及分页设置-->
<%
'查询
dim LogSql,LogRS
set LogRS=server.CreateObject("adodb.recordset")
LogSql="select * from Log order by ID desc"
LogRS.open LogSql,conn,3,2
'分页设置
if LogRS.RecordCount<>0 then
LogRS.PageSize=10 '每页显示数量
CurPage=Request("CurPage") '当前页
if CurPage="" then CurPage=1
LogRS.AbsolutePage=CurPage
end if
%>
<!--输出记录-->
<%do while not LogRS.eof and pagei<LogRS.PageSize%>
<%=LogRS("Title")%><br>
<%
pagei=pagei+1
LogRS.movenext
loop
%>
<!--显示分页-->
<form method="post" name="PageFrm" id="PageFrm" style="margin:0; padding:0;">
<%if CurPage=1 then%>
首页
<%else%>
<a href="?CurPage=1">首页</a>
<%end if%>
<%if CurPage=1 then%>
上一页
<%else%>
<a href="?CurPage=<%=CurPage-1%>">上一页</a>
<%end if%>
<%if LogRS.PageCount<CurPage+1 then%>
下一页
<%else%>
<a href="?CurPage=<%=CurPage+1%>">下一页</a>
<%end if%>
<%if LogRS.PageCount<CurPage+1 then%>
尾页
<%else%>
<a href="?CurPage=<%=LogRS.PageCount%>">尾页</a>
<%end if%> <%=CurPage%>/<%=LogRS.PageCount%>页 <%=LogRS.PageSize%>个/页 共<%=LogRS.RecordCount%>个 跳转到
<input name="ToPage" type="text" id="ToPage" value="<%=CurPage%>" size="4" onKeyDown="EnterGo();" />页
<input name="ToGageBtn" type="button" class="cwy_01" onClick="GoToPage();" value=" GO " />
</form>
<script language="javascript">
//文本框回车实现点击GO按钮
function EnterGo()
{
if(event.keyCode ==13)
{
document.getElementById("ToGageBtn").click();
event.returnValue = false;
}
}
//跳转页
function GoToPage(){
var getpage
getpage=document.PageFrm.ToPage.value
if(isNaN(getpage)){
alert('请输入数字!')
document.PageFrm.ToPage.focus();
return false;
}
else if (getpage<1)
{
getpage=1
}
else if (getpage><%=LogRS.PageCount%>)
{
getpage=<%=LogRS.PageCount%>
}
else
{
getpage=document.PageFrm.ToPage.value
}
location='?CurPage='+getpage
}
</script>