<script>ec(2);</script> 这是一段简单的asp分页显示代码并以asp 分页显示源代码的形式提供给大家, <table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy5701')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy5701> <%@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>无标题文档</title> </head> <body> <% dim Conn,rs Set Conn=Server.CreateObject("ADODB.Connection") Conn.ConnectionString = "Dbq="&Server.MapPath("liouyan.mdb")&"; Driver={Microsoft Access Driver (*.mdb)}" Conn.Open set rs=Server.createObject("ADODB.RecordSet") SQL="select * from userinfo" rs.open SQL,Conn,1,1 if Not rs.Bof and Not rs. Eof then dim page_no if request.QueryString("page_no")="" then page_no=1 else page_no=Cint(Request.QueryString("page_no")) end if rs.pageSize=5 rs.AbsolutePage=page_no dim I I=rs.pageSize do while Not rs.Eof and I>0 I=I-1 response.write rs("username") &"对你说:"&rs("word")& "<br>" rs.MoveNext loop response.write"请选择数据页:" for I=1 to rs.pageCount if I=page_no then response.write I &" " else response.write"<a href='xianshi.asp?page_no="&I&"'>" &I &"</a > " end if next else response.write"该记录集为空" end if rs.close set rs=nothing Conn.close set Conn=nothing %> </body> </html> </td> </tr> </table></td> </tr> </table>
|