<%
if not isempty(request.querystring("page")) then
pagecount=cint(request.querystring("page"))
else
pagecount=1
end if
dim id
id=request("id")
set rs=server.CreateObject("adodb.recordset")
strsql="select * from web_news where sortid="&id
rs.open strsql,conn,3,3
%>
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><img src="image/jiuye_<%=id%>.jpg" width="580" /></td>
</tr>
<tr>
<td>
<br>
<%if rs.bof and rs.eof then %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25"> 对不起,暂时没有信息!</td>
</tr>
</table>
<%else
rs.pagesize=30
if pagecount>rs.pagecount or pagecount<=0 then
pagecount=1
end if
rs.AbsolutePage=pagecount
i=1
%>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
<%do while not rs.eof
sortid=rs("sortid")
set ra=server.CreateObject("adodb.recordset")
sql="select * from web_news_class where id="&sortid
ra.open sql,conn,3,3
%>
<tr>
<td width="100">【<%=ra("sortname")%>】</td>
<td><a href="jxzx.asp?action=jyzx&id=<%=rs("id")%>"><%=rs("Topic")%></a></td>
<td width="30%"><font color="#999999"><%=rs("updatetimes")%></font></td>
</tr>
<% i=i+1
rs.movenext
if i>=rs.PageSize+1 then exit do
loop
%>
<tr>
<td width="100"> </td>
<td colspan="2" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="right">共<%=rs.pagecount%>页(<font color="#FF0000"><%=rs.recordcount%></font>)共条信息
<%if pagecount<=1 then%>
首页 上一页
<%else%>
<a href="<%=Request.ServerVariables("PATH_INFO")%>?action=kszx&page=1">首页</a> <a href="<%=Request.ServerVariables("PATH_INFO")%>?action=kszx&page=<%=pagecount-1%>">上一页</a>
<%end if %>
<%for page=1 to rs.pagecount%>
<%
if pagecount=page then
link_color="red"
else
link_color=""
end if
%>
[<a href="<%=Request.ServerVariables("PATH_INFO")%>?action=kszx&page=<%=page%>"><font color="<%=link_color%>"><%=page%></font></a>]
<%next%>
<%if pagecount>=rs.pagecount then%>
下一页 尾页
<%else%>
<a href="<%=Request.ServerVariables("PATH_INFO")%>?action=kszx&page=<%=pagecount+1%>">下一页</a> <a href="<%=Request.ServerVariables("PATH_INFO")%>?action=kszx&page=<%=rs.pagecount%>">尾页</a>
<%end if %>
<%end if%>
</div></td>
</tr>
</table> </td>
</tr>
</table>
</td>
</tr>
</table>
这是我的分页代码