<% if pagecount<=10 then%>
<%elseif page=1 and page=pagecount then%>
<%else%>
<div align="right">第<%=page%>页 <%for i=1 to pagecount%>
<a href="list.asp?page=<%=i%>"><%=i%></a> <%next%><a href="list.asp?page=<%=page-1%>">上一页</a>
<a href="list.asp?page=<%=page+1%>">下一页</a> </div>
<% elseif pagecount>=10 then%>
<%elseif page=pagecount-9 and page=pagecount then%>
<%else%>
<div align="right">第<%=page%>页 <%for i=pagecount-9 to pagecount%>
<a href="list.asp?page=<%=i%>"><%=i%></a> <%next%><a href="list.asp?page=<%=page-1%>">上一页</a>
<a href="list.asp?page=<%=page+1%>">下一页</a> </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"> </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></td>
</tr>
<tr>
<td colspan="3" height="40" style="padding-top:4px;"><span class="hang1"><img src="image/regb.gif" width="18" height="18"> <b>专家解答:</b>
<%
Set rs2 = Server.CreateObject ("ADODB.Recordset")
id=rs("id")
sql2="select * from "&tablename3&" where reid="&id&""
'response.write(sql2)
'response.end()
rs2.Open sql2, conn, 1,3
if rs2.eof then
response.write("<font color=red>尚未回复</font>")
else
%><span style="color:#008000; font-size:13px;"><%=rs2("remessage")%></span><%end if%></span></td>
</tr>
</table></td>
</tr>
<tr>
<td height="5"></td>
</tr>
<%
rs.movenext
next
%>
<tr><td height="30">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr align="center" valign="top">
<td width="3"></td>
<!--控制第一张图片,有没有上一页-->
<td width="40" align="center" class="style1" valign="middle">
<%if page=1 or page<1 then%>
<a href="yhhd.asp">首 页</a>
<%end if%>
<%if page>1 then%>
<a href="yhhd.asp?Page=<%=page-1%>"><!--<img src="nav_previous.gif" width="68" height="26" border="0"><br>-->上一页</a>
<%end if%>
</td>
<!--//-->
<td width="3"></td>
<!--当前页面前,循环显示4页-->
<%
'1-4页要特殊对待
if page>1 then a=1
if page>2 then a=2
if page>3 then a=3
if page>4 then a=4
if page>5 then a=5
'当前页面前,循环显示4页
for i=page-a to page-1 %>
<td width="3"></td>
<td width="25" align="center" class="style1" valign="middle">
<a href="yhhd.asp?Page=<%=i%>"><%=i%></a>
</td>
<td width="3"></td>
<% next %>
<td width="3"></td>
<!--当前所在页面-->
<td width="25" align="center" class="style1" valign="middle" bgcolor="#FCF1E2"><font color="#FF0000"><%=page%></font>
</td>
<td width="3"></td>
<!--//-->
<!--当前页面后,循环显示4页-->
<%
for i=page+1 to page+15
if i>rs.PageCount then exit for
%>
<td width="3"></td>
<td width="25" align="center" class="style1" valign="middle">
<a href="yhhd.asp?Page=<%=i%>"><!--<img src="nav_page.gif" width="16" height="26" border="0"><br>--><%=i%></a>
</td>
<td width="3"></td>
<%
next
%>
<!--//-->
<td width="3"></td>
<!--控制最后一张图片,有没有下一页-->
<td width="40" align="center" class="style1" valign="middle" height="20">
<% if page=rs.PageCount or page>rs.PageCount then %>
<!--<img src="nav_last.gif"> -->
<%else %><a href="yhhd.asp?Page=<%=page+1%>"><!--<img src="nav_next.gif" width="100" height="26" border="0"><br>-->下一页</a>
<% end if %>
</td>
<td width="3"></td>
<!--//-->
</tr>
</table>
</td></tr>
</table>
<%
rs.close
Set rs = Nothing
conn.close
set conn=nothing
%>