本人常用的分页代码
来源:ASP学习网 作者:Admin 时间:08-08-11 点击:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>个人会员管理</title>
<link href="main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.closes
{
font-size:9pt;
color:#333333;
background-color:#f7f7f7;
border:1px solid #CCCCCC;}
</style>
<script type="text/javascript">
function selectall() {
for (var z=0;z<=document.formselect.memberid.length;z++) {
var e=document.formselect.memberid[z];
e.checked=!e.checked;
}
}
function delmember(id)
{
if (confirm('你确定要删除此条信息吗?')){
window.open("gr_delselect.asp?id="+id,"","width=150,height=20,resizable=yes,
scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no");}}
function killerror(){
return true;
}
window.onerror=killerror;
</script>
</head>
<body>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF" style="border:1px solid #799AE1">
<tr>
<td height="25" colspan="5" bgcolor="#799AE1" style="text-indent:2em;" class="blueback">个人会员列表</td>
</tr>
<tr>
<td width="36" height="25" bgcolor="#ADBEEF"><div align="center">序号</div></td>
<td width="244" bgcolor="#ADBEEF"><div align="center">用户名</div></td>
<td width="140" bgcolor="#ADBEEF"><div align="center">加入日期</div></td>
<td width="140" bgcolor="#ADBEEF"><div align="center">等级</div></td>
<td width="140" bgcolor="#ADBEEF"><div align="center">操作</div></td>
</tr>
<form action="gr_delselect.asp" method="post" name="formselect">
<%
dim maxperpage
maxperpage=20
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
filename="gr_member.asp"
dim rs
set rs=server.CreateObject("adodb.recordset")
sql="select id,dxy_username,datetime,dj from "&gr_membertable&" order by id desc"
rs.open sql,conn,1,1
if rs.eof then
response.write "没有相关信息"
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,filename
else
if (currentpage-1)*maxperpage<totalput then
rs.move (currentpage-1)*maxperpage
dim bookmark
bookmark=rs.bookmark
showcontent
showpage totalput,maxperpage,filename
else
currentpage=1
showcontent
showpage totalput,maxperpage,filename
end if
end if
end if
sub showcontent()
i=1
do while not rs.eof
%>
<tr>
<td height="25" bgcolor="#D6DFF7"><div align="center">
<input type="checkbox" name="memberid" value="<%=rs("id")%>">
</div></td>
&