asp 下面的代码怎样修改才能实现“上一页 下一页 共?页 当前第?页”啊? 20
<!--#includefile="conn.asp"--><b><ahref="say.asp">发表帖子</a></b><br><br><divalign="cent...
<!--#include file="conn.asp"-->
<b><a href="say.asp">发表帖子</a></b><br><br>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; " bordercolor="#000000" width="100%" height="26">
<tr>
<td width="17%"><b>作者</b></td>
<td width="83%"><b>主题</b></td>
</tr>
</table>
</center>
</div><hr size="1">
<%i=1
set showbbs=conn.execute("select*from bbs order by id desc")
do while not showbbs.eof
%>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; " bordercolor="#000000" width="100%" height="20">
<tr>
<td width="17%"><%=showbbs("name")%> </td>
<td width="83%">
<a href="show.asp?id=<%=showbbs("id")%>"><%=showbbs("title")%></a></td>
</tr>
</table>
</center>
</div><hr size="1">
<%i=i+1
if i>50 then exit do
showbbs.movenext
Loop
showbbs.Close
set showbbs=nothing
%> 展开
<b><a href="say.asp">发表帖子</a></b><br><br>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; " bordercolor="#000000" width="100%" height="26">
<tr>
<td width="17%"><b>作者</b></td>
<td width="83%"><b>主题</b></td>
</tr>
</table>
</center>
</div><hr size="1">
<%i=1
set showbbs=conn.execute("select*from bbs order by id desc")
do while not showbbs.eof
%>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; " bordercolor="#000000" width="100%" height="20">
<tr>
<td width="17%"><%=showbbs("name")%> </td>
<td width="83%">
<a href="show.asp?id=<%=showbbs("id")%>"><%=showbbs("title")%></a></td>
</tr>
</table>
</center>
</div><hr size="1">
<%i=i+1
if i>50 then exit do
showbbs.movenext
Loop
showbbs.Close
set showbbs=nothing
%> 展开
2个回答
展开全部
这是一个分页的写法:
<table cellspacing='1' cellpadding='3' id='list-table'>
<tr>
<th>编号</th>
<th>封面图片</th>
<th>名称</th>
<th>发布时间</th>
</tr>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from album order by id asc",conn,1,1
if not rs.eof then
i=0
rs.pagesize=10
page=request("page")
if trim(page)="" then
page=1
elseif Cint(page)<1 then
page=1
else
if not isnumeric(page) then page=1 end if
end if
if Cint(page)>rs.pagecount then page=rs.pagecount
rs.absolutepage=page
for m=1 to rs.pagesize
if rs.eof then exit for
%>
<tr>
<td align="center"><%=rs("id")%></td>
<td align="center" nowrap="true"><img src="<%=rs("cover")%>" width="50px" height="50px"></td>
<td align="center" nowrap="true" class="center"><%=rs("title")%></td>
<br />
<td align="center" nowrap="true" class="center"><%=rs("time")%></td>
</tr>
<% rs.movenext
i=i+1
next
end if
%>
<tr>
<td colspan="4"><div id="turn-page" style="text-align:right"> 总计 <span id="totalRecords"><%=rs.recordcount%></span> 个记录分为 <span id="totalPages"><%=rs.pagecount%></span> 页当前第 <span id="pageCurrent"><%=page%></span> 页 <span id="page-link"> <a href="?art_type=<%=request("art_type")%>&page=1">第一页</a& gt; <a href="?art_type=<%=request("art_type")%>&page=<%=page-1%& gt;">上一页</a> <a href="?art_type=<%=request("art_type")%>&page=<%=page+1%& gt;">下一页</a> <a href="?art_type=<%=request("art_type")%>&page=& lt;%=rs.pagecount%>">最末页</a> </span> </div></td>
</tr>
</table>
这个分页程序简单而且使用,你看看合不合适。
<table cellspacing='1' cellpadding='3' id='list-table'>
<tr>
<th>编号</th>
<th>封面图片</th>
<th>名称</th>
<th>发布时间</th>
</tr>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from album order by id asc",conn,1,1
if not rs.eof then
i=0
rs.pagesize=10
page=request("page")
if trim(page)="" then
page=1
elseif Cint(page)<1 then
page=1
else
if not isnumeric(page) then page=1 end if
end if
if Cint(page)>rs.pagecount then page=rs.pagecount
rs.absolutepage=page
for m=1 to rs.pagesize
if rs.eof then exit for
%>
<tr>
<td align="center"><%=rs("id")%></td>
<td align="center" nowrap="true"><img src="<%=rs("cover")%>" width="50px" height="50px"></td>
<td align="center" nowrap="true" class="center"><%=rs("title")%></td>
<br />
<td align="center" nowrap="true" class="center"><%=rs("time")%></td>
</tr>
<% rs.movenext
i=i+1
next
end if
%>
<tr>
<td colspan="4"><div id="turn-page" style="text-align:right"> 总计 <span id="totalRecords"><%=rs.recordcount%></span> 个记录分为 <span id="totalPages"><%=rs.pagecount%></span> 页当前第 <span id="pageCurrent"><%=page%></span> 页 <span id="page-link"> <a href="?art_type=<%=request("art_type")%>&page=1">第一页</a& gt; <a href="?art_type=<%=request("art_type")%>&page=<%=page-1%& gt;">上一页</a> <a href="?art_type=<%=request("art_type")%>&page=<%=page+1%& gt;">下一页</a> <a href="?art_type=<%=request("art_type")%>&page=& lt;%=rs.pagecount%>">最末页</a> </span> </div></td>
</tr>
</table>
这个分页程序简单而且使用,你看看合不合适。
展开全部
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<LINK media=all href="../admin/css/admin.css" type=text/css rel=stylesheet>
<title>无标题文档</title>
</head>
<body>
<div class="container" id="cpcontainer">
<form method="post" action="admin-dian-save.asp?action=dian-del" name="form">
<table class="tb">
<tr class="thead">
<th colspan="5" align="center" bgcolor="#FFFFFF">加盟点管理</th>
</tr>
<tr bgcolor="#666666">
<td width="12%" align="center" bgcolor="#FFFFFF"><span class="STYLE1">选取</span></td>
<td width="28%" align="left" bgcolor="#FFFFFF"><span class="STYLE1">加盟点名称</span></td>
<td width="32%" align="left" bgcolor="#FFFFFF"><span class="STYLE1">加盟点网址</span></td>
<td width="28%" align="center" bgcolor="#FFFFFF">修改</td>
</tr>
<%
sql = "select * from Fcw_Dian order by dian_ID desc"
set rs = server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof then
response.write "<table><tr><td><br></br><center>现在还没有记录!</center><br></br></td></tr></table>"
response.end
end if
if not rs.eof then
rs.pagesize =15
page =1
if not isempty(request("page")) and request("page") <> "" then
page = Cint(request("page"))
if page>rs.pagecount then
page = rs.pagecount
rs.AbsolutePage = page
elseif page<1 then
page = 1
rs.AbsolutePage = 1
else
page = Cint(request("page"))
rs.AbsolutePage = page
end if
else
page = 1
end if
end if
%>
<%for i=1 to rs.pagesize
if rs.eof then exit for
%>
<tr bgcolor="#868686">
<td width="12%" height="22" align="center" bgcolor="#FFFFFF"> <input name="dianid" type="checkbox" class="checkbox" id="dianid" value="<%=trim(rs("dian_ID"))%>"></td>
<td width="28%" height="22" align="left" bgcolor="#FFFFFF"><%=left(rs("dian_Name"),25)%> </td>
<td width="32%" height="22" align="left" bgcolor="#FFFFFF"><a href="<%=rs("dian_Url")%>" target="_blank"><%=rs("dian_Url")%></a> </td>
<td width="28%" height="22" align="center" bgcolor="#FFFFFF"><a href="admin-dian-edit.asp?dian_ID=<%=rs("dian_ID")%>">修改</a></td>
</tr>
<%
rs.movenext
next
%>
<tr bgcolor="#868686">
<td colspan="5" bgcolor="#FFFFFF"><TABLE align="center">
<TR>
<TD height="50">
共<%=rs.pagecount%>页 第<%=page%>页
<%if rs.recordcount<>0 then
if page <> 1 then %>
<a href="admin-dian.asp?page=<%=1%>">首页</a>
<a href="admin-dian.asp?page=<%=page-1%>">上一页</a>
<%end if%>
<% if page <> rs.pagecount then %>
<a href="admin-dian.asp?page=<%=page+1%>">下一页</a>
<a href="admin-dian.asp?page=<%=rs.pagecount%>">尾页</a>
<%end if%>
<%end if%> </TD>
<TD><script language="JavaScript">
<!--
function FP_jumpMenu(el,frm,sel) {//v1.0
var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
}
// -->
</script>
<DIV align="left">
<select size="1" onChange="FP_jumpMenu(this,'window',false)" id="id1" name="D1" style="font-size: 9pt; border-style: solid; border-width: 1px">
<%for i=1 to rs.pagecount%>
<option value="<%=request.servervariables("URL")%>?page=<%=i%>" <%if page=i then response.write "selected"%>>第<%=i%>页</option>
<%next%>
</select>
</DIV></TD>
</TR>
</TABLE></td>
</tr>
<tr>
<td colspan="5" align="center" height="50"> <input name="B1" type="submit" class="btn" value="删除">
<input name="B2" type="reset" class="btn" value="全部重写">
</td>
</tr>
</table>
</form></div>
</body>
</html>
这是一个整页面,你直接拷贝就行了,就是sql语句和几个参数字段你改下就行了。 不知道的就再问。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<LINK media=all href="../admin/css/admin.css" type=text/css rel=stylesheet>
<title>无标题文档</title>
</head>
<body>
<div class="container" id="cpcontainer">
<form method="post" action="admin-dian-save.asp?action=dian-del" name="form">
<table class="tb">
<tr class="thead">
<th colspan="5" align="center" bgcolor="#FFFFFF">加盟点管理</th>
</tr>
<tr bgcolor="#666666">
<td width="12%" align="center" bgcolor="#FFFFFF"><span class="STYLE1">选取</span></td>
<td width="28%" align="left" bgcolor="#FFFFFF"><span class="STYLE1">加盟点名称</span></td>
<td width="32%" align="left" bgcolor="#FFFFFF"><span class="STYLE1">加盟点网址</span></td>
<td width="28%" align="center" bgcolor="#FFFFFF">修改</td>
</tr>
<%
sql = "select * from Fcw_Dian order by dian_ID desc"
set rs = server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof then
response.write "<table><tr><td><br></br><center>现在还没有记录!</center><br></br></td></tr></table>"
response.end
end if
if not rs.eof then
rs.pagesize =15
page =1
if not isempty(request("page")) and request("page") <> "" then
page = Cint(request("page"))
if page>rs.pagecount then
page = rs.pagecount
rs.AbsolutePage = page
elseif page<1 then
page = 1
rs.AbsolutePage = 1
else
page = Cint(request("page"))
rs.AbsolutePage = page
end if
else
page = 1
end if
end if
%>
<%for i=1 to rs.pagesize
if rs.eof then exit for
%>
<tr bgcolor="#868686">
<td width="12%" height="22" align="center" bgcolor="#FFFFFF"> <input name="dianid" type="checkbox" class="checkbox" id="dianid" value="<%=trim(rs("dian_ID"))%>"></td>
<td width="28%" height="22" align="left" bgcolor="#FFFFFF"><%=left(rs("dian_Name"),25)%> </td>
<td width="32%" height="22" align="left" bgcolor="#FFFFFF"><a href="<%=rs("dian_Url")%>" target="_blank"><%=rs("dian_Url")%></a> </td>
<td width="28%" height="22" align="center" bgcolor="#FFFFFF"><a href="admin-dian-edit.asp?dian_ID=<%=rs("dian_ID")%>">修改</a></td>
</tr>
<%
rs.movenext
next
%>
<tr bgcolor="#868686">
<td colspan="5" bgcolor="#FFFFFF"><TABLE align="center">
<TR>
<TD height="50">
共<%=rs.pagecount%>页 第<%=page%>页
<%if rs.recordcount<>0 then
if page <> 1 then %>
<a href="admin-dian.asp?page=<%=1%>">首页</a>
<a href="admin-dian.asp?page=<%=page-1%>">上一页</a>
<%end if%>
<% if page <> rs.pagecount then %>
<a href="admin-dian.asp?page=<%=page+1%>">下一页</a>
<a href="admin-dian.asp?page=<%=rs.pagecount%>">尾页</a>
<%end if%>
<%end if%> </TD>
<TD><script language="JavaScript">
<!--
function FP_jumpMenu(el,frm,sel) {//v1.0
var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
}
// -->
</script>
<DIV align="left">
<select size="1" onChange="FP_jumpMenu(this,'window',false)" id="id1" name="D1" style="font-size: 9pt; border-style: solid; border-width: 1px">
<%for i=1 to rs.pagecount%>
<option value="<%=request.servervariables("URL")%>?page=<%=i%>" <%if page=i then response.write "selected"%>>第<%=i%>页</option>
<%next%>
</select>
</DIV></TD>
</TR>
</TABLE></td>
</tr>
<tr>
<td colspan="5" align="center" height="50"> <input name="B1" type="submit" class="btn" value="删除">
<input name="B2" type="reset" class="btn" value="全部重写">
</td>
</tr>
</table>
</form></div>
</body>
</html>
这是一个整页面,你直接拷贝就行了,就是sql语句和几个参数字段你改下就行了。 不知道的就再问。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询