请大家指点指点啊~~
好久没有上来啊,来了好多人啊!!
不过论坛的人气好象不怎么好哦~~~~
<!--#include file="conn.asp"--> <% dim page,sql,rs,n,pagesize,pagecount page=request("page") if page<>"" then page=request("page") else if page<1 or page="" then page=1 end if if err.number <> 0 then err.clear page = 1 end if page=1 end if pagesize=3 //定义一页显示的数据条数 set rs= Server.CreateObject("adodb.recordset") sql ="select * from data" rs.cursorlocation = 3 rs.pagesize=pagesize rs.open sql,conn,1,1 pagecount=rs.pagecount if page="" or page=err.number then err.clear rs.absolutepage=1 else rs.absolutepage=page end if //转到你想要的那页 %> <b>分页示例</b><p> <% //读取数据 do while not rs.eof and pagesize>0 response.write rs("id") response.write "----" response.write rs("name") response.write "----" response.write rs("time") response.write "<p>" pagesize=pagesize-1 rs.movenext loop call CloseDatabase %> <P>共有<%=pagecount%>页</p> <% //下面的这些是我试验N次得出来了,:)? if page=1 or page= "" then response.write"<font color='black'>首页</font>" response.write"<font color='black'>上一页</font>" if pagecount=1 then response.write"<font color='black'>下一页</font>" response.write"<font color='black'>尾页</font>" else response.write "<a href=1.asp?page="&request("page")+1&">下一页</a>" response.write "<a href=1.asp?page="&pagecount&">尾页</a>" end if end if %> <%if pagesize*page<pagecount and page<>1 and page<>"" then response.write "<a href=1.asp?page=1>首页</a>" response.write "<a href=1.asp?page="&request("page")-1&">上一页</a>" response.write "<a href=1.asp?page="&request("page")+1&">下一页</a>" response.write "<a href=1.asp?page="&pagecount&">尾页</a>" end if %> <%if pagesize*page>=pagecount then response.write "<a href=1.asp?page=1>首页</a>" response.write "<a href=1.asp?page="&request("page")-1&">上一页</a>" response.write"<font color='black'>下一页</font>" response.write"<font color='black'>尾页</font>" end if %> <% %> <p> <% if pagecount>1 then for n=1 to pagecount response.write "<a href=1.asp?page="&n&">[" response.write n response.write "]</a>" next end if %>
[此贴子已经被作者于2004-07-08 18:01:32编辑过]