日期:2014-05-17  浏览次数:20922 次

高手来看下分页代码哪的问题
<% if pagecount<=10 then%>
  <%elseif page=1 and page=pagecount then%>
   
  <%else%>
  <div align="right">第<%=page%>页&nbsp;&nbsp;<%for i=1 to pagecount%>
<a href="list.asp?page=<%=i%>"><%=i%></a>&nbsp;<%next%><a href="list.asp?page=<%=page-1%>">上一页</a> 
  <a href="list.asp?page=<%=page+1%>">下一页</a>&nbsp;&nbsp;</div>

  <% elseif pagecount>=10 then%>
  <%elseif page=pagecount-9 and page=pagecount then%>
   
  <%else%>
  <div align="right">第<%=page%>页&nbsp;&nbsp;<%for i=pagecount-9 to pagecount%>
<a href="list.asp?page=<%=i%>"><%=i%></a>&nbsp;<%next%><a href="list.asp?page=<%=page-1%>">上一页</a> 
  <a href="list.asp?page=<%=page+1%>">下一页</a>&nbsp;&nbsp;</div>
<%end if%>


具体就是每页显示10个页面的连接例如1-10 2-11 3-12 等等
以上代码无法运行 1-10 能显示 但不知道对否 求赐教

------解决方案--------------------
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from userinfo where look=1 order by id desc"
rs.open sql,conn,1,3 
page=1 ' 设置变量PAGE=1 
rs.PageSize = 10 '每页显示记录数 
if Not IsEmpty(Request("Page")) then '如果PAGE已经初始化... 
Page = CInt(Request("Page")) '接收PAGE并化为数字型赋给PAGE变量 
if Page > rs.PageCount then '如果接收的页数大于总页数 
rs.AbsolutePage = rs.PageCount '设置当前显示页等于最后页 
elseif Page <= 0 then '如果page小于等于0 
Page = 1 '设置PAGE等于第一页 
else 
rs.AbsolutePage = Page '如果大于零,显示当前页等于接收的页数 
end if 
End if 
Page = rs.AbsolutePage 
For i = 1 to rs.PageSize 
if rs.EOF then 
Exit For 
end if '利用for next 循环依次读出记录 
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
<tr>
<td style="border:#7B7B7B 1px dashed;" class="askpod"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="24%" height="35" class="dilian">姓名:<%=rs("s_name")%>(<%=rs("s_sex")%>)</td>
<td width="44%" height="30" class="dilian">&nbsp;</td>
<td width="32%" class="dilian">留言时间:【<%=rs("s_date")%>】</td>
</tr>
<tr>
<td height="35" colspan="3" class="dilian"><span class="hang1">主题:<%=rs("s_title")%></span></td>
</tr>
<tr>
<td colspan="3" height="40" class="dilian" style="padding-top:4px;"><span class="hang1">留言内容:<span style="color:#FF0000; font-size:13px;"><%=rs("s_message")%></span></span>&l