高手!!asp怎么分页???
我的代码是这样的!!
<!--#include file="css1.asp"-->
<div align="center">
<table width="437" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="127" colspan="5" valign="top"><!--#include file="head.asp"--></td>
</tr>
<tr>
<td width="8" height="301" valign="top" background=images/back_l.gif><!--DWLayoutEmptyCell--> </td>
<td width="152" valign="top"><!--#include file="right-1.asp"--></td>
<td width="700" valign="top"><div align="left">
<!--#include file="middle-1.asp"-->
</div></td>
<td width="157" valign="top"><!--#include file="left.asp"--></td>
<td background=images/back_r.gif width="8" valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="107" colspan="5" valign="top"><!--#include file="copy.asp"--></td>
</tr>
</table>
<!--#include file="top.asp"-->
</div>
参考答案:<%
dim page,pagesize
'获得用户显示的页数
page=request.QueryString("whichpage")
if page="" then
page=1
end if
'获得每页的大小,显示记录的条数
pagesize=request.querystring("pagesize")
if pagesize="" then
pagesize=15
end if
rs.cachesize=15
rs.open "select * from news",conn,1,3
'设定分页设置
rs.movefirst '移动到第一条记录本
'设定每页的大小,显示记录条数
rs.pagesize=pagesize
'总页数
maxcount=cint(rs.pagecount)
'设定显示的第几页
rs.absolutepage=page
'用户记录每页显示的记录数
howmanyrecs=0
%>
</tr>
</table>
<table width="100%" height="36" border="0" cellpadding="0" cellspacing="0" background="Images/xiantiao.jpg" class="font">
<% do while not rs.eof and cint(howmanyrecs)<cint(pagesize)%>
<tr>
<td height="9" align="left" valign="middle" bgcolor="#FAFAFA"><a href="xiangxiYe.asp?id=<%=rs("id")%>"><span class="style13"> ·</span><%=rs("title")%> </a><span class="d"><%=rs("infotime")%></span>
</td>
</tr>
<tr>
<td height="9" align="left" valign="middle" bgcolor="#FAFAFA"><img src="Images/bg.gif" width="51" height="1"><img src="Images/bg.gif" width="51" height="1"><img src="Images/bg.gif" width="51" height="1"><img src="Images/bg.gif" width="51" height="1"><img src="Images/bg.gif" width="51" height="1"><img src="Images/bg.gif" width="51" height="1"><img src="Images/bg.gif" width="51" height="1"><img src="Images/bg.gif" width="51" height="1"></td>
</tr>
<%
rs.movenext
howmanyrecs=howmanyrecs+1
loop
%>
</table>
<table width="100%" height="35" border="0" cellpadding="0" cellspacing="0" class="aa">
<tr>
<td height="35" align="center" valign="middle">
<%
if Page<2 then
response.write "首页 上一页 "
else
response.write "<a href=xinwenZQ.asp?whichpage=1&pagesize=15>首页</a> "
response.write "<a href=xinwenZQ.asp?whichpage="& (page-1) &"&pagesize=15>上一页</a> "
end if
if maxcount-page<1 then
response.write "下一页 尾页"
else
response.write "<a href=xinwenZQ.asp?whichpage=" & (page+1) &"&pagesize=15>下一页</a>"
response.write " <a href=xinwenZQ.asp?whichpage="& maxcount&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&Page&"</font>/"& maxcount &"</strong>页 "
response.write " 共<b><font color='#FF0000'>"& rs.recordcount &"</font></b>条记录 <b>"&pagesize&"</b>条记录/页"
rs.close%>
这是分页的代码,你拿去试试