加入收藏 | 设为首页 | 会员中心 | 我要投稿 汽车网 (https://www.0577qiche.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

asp分页(自行整理的2个分页程序)

发布时间:2023-08-26 09:10:10 所属栏目:Asp教程 来源:
导读:asp分页(自己整理的2个分页程序)

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
asp分页(自己整理的2个分页程序)

<%@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>页

(编辑:汽车网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章