<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>asp分页程序</title>
<style type="text/css">
<!--
.STYLE1 {font-size: 12px}
-->
</style></head>
<body>
<p>
<table width="186" height="39" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>姓名</td>
<td>密码</td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
conn = "DBQ=" + server.mappath("zheng.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
sql="select * from user"
rs.open sql,conn,1,2
rs.pagesize=6 '设置页面显示得页数
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>rs.pagecount then epage=rs.pagecount
else
epage=1
end if
rs.absolutepage=epage
for i=0 to rs.pagesize-1
if rs.bof or rs.eof then exit for
%><tr>
<td><%=rs("name")%></td>
<td><%=rs("pass")%></td>
</tr>
<%
rs.movenext
next
%>
</table>
<div align="left"><span class="STYLE1">
<form method="get" onsubmit=""document.location ="c.asp?Page='+ this.page.value;return false;'">
<%if epage=1 then response.Write("首页")else response.Write("<a href='c.asp?page=1'>"&"首页"&"</a>")%>
<%if epage=1 then response.write("上一页")else response.write"<a href=c.asp?page="&epage-1&">上一页</a>"%>
<%if epage = rs.pagecount then response.write("下一页")else response.write"<a href=c.asp?page="&epage+1&">下一页</a>"%>
<%if epage = rs.pagecount then response.write("末页")else response.write"<a href=c.asp?page="&rs.pagecount&">末页</a>"%>
现在是第<font color="red"><%=epage%></font>页一共有<font color="red"><%=rs.pagecount%></font>页
asp分页(自己整理的2个分页程序)
内容版权声明:除非注明,否则皆为本站原创文章。