在我的asp程序加入分页显示代码
<!--#includefile="conn.asp"--><%sql="select*fromerenneworderbyiddesc"setrs=db.execute...
<!--#include file="conn.asp"-->
<%
sql="select * from erennew order by id desc"
set rs=db.execute(sql)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新闻显示页面</title>
<style type="text/css">
<!--
table {
font-size: 9pt;
text-decoration: none;
border: 1px solid #000000;
}
-->
</style>
<style type="text/css">
<!--
a {
font-size: 9pt;
color: #000000;
text-decoration: none;
}
-->
</style>
</head>
<body>
<table width="598" border="0" align="center" cellpadding="5" cellspacing="0">
<tr align="center" bgcolor="#006699">
<td><font color="#FFFFFF">新 闻 显 示 页 面</font></td>
</tr>
<%
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.CursorType=3
rs.open"select * from kehu",conn
rs.pagesize=3
Page=CLng(request("Page"))
if Page < 1 then Page = 1
if Page > rs.pagecount then Page = rs.pagecount
rs.absolutepage=Page
for ipage = 1 to rs.pagesize
Recno = (Page - 1)*rs.pagesize+ipage
%>
<%do while not rs.eof%>
<tr>
<td height="28" align="left"> <img src="images/page.gif" width="12" height="14"> <a href=xw_look.asp?id=<%=rs("id")%> target="_blank"><%=rs("title")%></a> (<font color="#006699"><%=rs("xwtime")%>发表</font>) <font color="#006699"> 浏览过<%=rs("xwcount")%>次</font></td>
</tr>
<%
rs.movenext
loop
%>
<%
if Page<>1 then
response.Write "<a href= "index.asp?Page=1">第一页</a> "
response.Write "<a href="index.asp?Page="&(Page-1)&"">上一页</a> "
end if
if Page<>rs.pagecount then
response.Write "<a href="index.asp?Page="&(Page+1)&"">下一页</a> "
response.Write "<a href="index.asp?Page="&rs.pagecount&"">最后一页</a> "
end if
%>
<%
rs.close
conn.close
%>
</table>
<div align="center"><br>
<a href="admin/xw_login.asp">管理入口</a><br>
</div>
</body>
</html> 展开
<%
sql="select * from erennew order by id desc"
set rs=db.execute(sql)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新闻显示页面</title>
<style type="text/css">
<!--
table {
font-size: 9pt;
text-decoration: none;
border: 1px solid #000000;
}
-->
</style>
<style type="text/css">
<!--
a {
font-size: 9pt;
color: #000000;
text-decoration: none;
}
-->
</style>
</head>
<body>
<table width="598" border="0" align="center" cellpadding="5" cellspacing="0">
<tr align="center" bgcolor="#006699">
<td><font color="#FFFFFF">新 闻 显 示 页 面</font></td>
</tr>
<%
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.CursorType=3
rs.open"select * from kehu",conn
rs.pagesize=3
Page=CLng(request("Page"))
if Page < 1 then Page = 1
if Page > rs.pagecount then Page = rs.pagecount
rs.absolutepage=Page
for ipage = 1 to rs.pagesize
Recno = (Page - 1)*rs.pagesize+ipage
%>
<%do while not rs.eof%>
<tr>
<td height="28" align="left"> <img src="images/page.gif" width="12" height="14"> <a href=xw_look.asp?id=<%=rs("id")%> target="_blank"><%=rs("title")%></a> (<font color="#006699"><%=rs("xwtime")%>发表</font>) <font color="#006699"> 浏览过<%=rs("xwcount")%>次</font></td>
</tr>
<%
rs.movenext
loop
%>
<%
if Page<>1 then
response.Write "<a href= "index.asp?Page=1">第一页</a> "
response.Write "<a href="index.asp?Page="&(Page-1)&"">上一页</a> "
end if
if Page<>rs.pagecount then
response.Write "<a href="index.asp?Page="&(Page+1)&"">下一页</a> "
response.Write "<a href="index.asp?Page="&rs.pagecount&"">最后一页</a> "
end if
%>
<%
rs.close
conn.close
%>
</table>
<div align="center"><br>
<a href="admin/xw_login.asp">管理入口</a><br>
</div>
</body>
</html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询