帮我看下这个想添加ASP分页显示的代码。 要求有注释。谢谢
如题代码如下:<%@LANGUAGE="VBScript"codepage="936"%><!--#includefile="conn.asp"--><%setrs=se...
如题 代码如下:
<%@LANGUAGE="VBScript" codepage="936"%>
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select user,qq,email,content,data from main order by id desc"
rs.open sql,conn,1,1
%>
<%do while not rs.eof%>
<html>
<head>
<title>延续留言本-首页</title>
<link href="style.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><TABLE id=Table40 cellSpacing=1 cellPadding=3 width=450
bgColor=#c6d7c6 border=0>
<TBODY>
<TR>
<TD colspan="2" bgColor=#f5faf5><TABLE cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD width="88%"><P style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px"><span class="text1" style="font-weight: bold"><%=rs("user")%></span> 留言于 <%=rs("data")%></P></TD>
<TD width="12%" align=right><a href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=rs("qq")%>" target="_blank">QQ</a> <a href="mailto:<%=rs("email")%>">邮件</a></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD width=50 bgColor=white><P class="text2" style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px">内容:</p></TD>
<TD width=385 bgColor=white><P style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px"><%=rs("content")%></p></TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
<tr>
<td height="20"></td>
</tr>
</table>
<%
rs.movenext
loop
%>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="330" align="center"></td>
<td align="center"><a href="add.asp">填写留言</a></td>
<td align="center"><a href="admin.asp">管理留言</a></td>
</tr>
</table>
</body>
</html>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%> 展开
<%@LANGUAGE="VBScript" codepage="936"%>
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select user,qq,email,content,data from main order by id desc"
rs.open sql,conn,1,1
%>
<%do while not rs.eof%>
<html>
<head>
<title>延续留言本-首页</title>
<link href="style.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><TABLE id=Table40 cellSpacing=1 cellPadding=3 width=450
bgColor=#c6d7c6 border=0>
<TBODY>
<TR>
<TD colspan="2" bgColor=#f5faf5><TABLE cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD width="88%"><P style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px"><span class="text1" style="font-weight: bold"><%=rs("user")%></span> 留言于 <%=rs("data")%></P></TD>
<TD width="12%" align=right><a href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=rs("qq")%>" target="_blank">QQ</a> <a href="mailto:<%=rs("email")%>">邮件</a></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD width=50 bgColor=white><P class="text2" style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px">内容:</p></TD>
<TD width=385 bgColor=white><P style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px"><%=rs("content")%></p></TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
<tr>
<td height="20"></td>
</tr>
</table>
<%
rs.movenext
loop
%>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="330" align="center"></td>
<td align="center"><a href="add.asp">填写留言</a></td>
<td align="center"><a href="admin.asp">管理留言</a></td>
</tr>
</table>
</body>
</html>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%> 展开
2个回答
展开全部
<%@LANGUAGE="VBScript" codepage="936"%>
<!--#include file="conn.asp"-->
<%
dim selss
set selss=server.createobject("adodb.recordset")
sql="select user,qq,email,content,data from main order by id desc"
selss.open sql,conn,1,1
if selss.eof or selss.bof then
response.write "米信息!"
else
selss.pagesize=10
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>缓改selss.pagecount then epage=selss.pagecount
else
epage=1
end if
selss.absolutepage=epage
%>
<html>
<head>
<title>延续留言本-首碧哪雹页</title>
<link href="style.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<%
for i=0 to selss.pagesize-1
if selss.bof or selss.eof then exit for
%>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><TABLE id=Table40 cellSpacing=1 cellPadding=3 width=450
bgColor=#c6d7c6 border=0>
<TBODY>
<TR>
<TD colspan="2" bgColor=#f5faf5><TABLE cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD width="88%"><P style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px"><span class="text1" style="font-weight: bold"><%=selss("user")%></span> 留言于 <%=selss("data")%></P></TD>
<TD width="12%" align=right><a href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=selss("qq")%>" target="_blank">QQ</a> <a href="mailto:<%=selss("email")%>">邮件</a></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD width=50 bgColor=white><P class="text2" style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px">内容:</p></TD>
<TD width=385 bgColor=white><P style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px"><%=selss("content")%></p></TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
<tr>
<td height="20">悔帆</td>
</tr>
</table>
<%
selss.movenext()
next
end if
%>
</ul>
<br>
<div class=fc align=center> 共<%=selss.pagecount%>页 每页10项 当前页<%=epage%>/<%=selss.pagecount%> <a
id=ctl03_hlFirstPage href="x.asp">首页</a>
<a id=ctl03_hlPrevPage
href="?page=<%=epage-1%>">上一页</a>
<a id=ctl03_hlNextPage
href="?page=<%=epage+1%>">下一页</a> <a
id=ctl03_hlLastPage
href="?page=<%=selss.pagecount%>">最后一页</a>
</div></td>
</tr>
</tbody>
</table>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="330" align="center"></td>
<td align="center"><a href="add.asp">填写留言</a></td>
<td align="center"><a href="admin.asp">管理留言</a></td>
</tr>
</table>
</body>
</html>
<%
selss.close
set selss=nothing
conn.close
set conn=nothing
%>
<!--#include file="conn.asp"-->
<%
dim selss
set selss=server.createobject("adodb.recordset")
sql="select user,qq,email,content,data from main order by id desc"
selss.open sql,conn,1,1
if selss.eof or selss.bof then
response.write "米信息!"
else
selss.pagesize=10
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>缓改selss.pagecount then epage=selss.pagecount
else
epage=1
end if
selss.absolutepage=epage
%>
<html>
<head>
<title>延续留言本-首碧哪雹页</title>
<link href="style.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<%
for i=0 to selss.pagesize-1
if selss.bof or selss.eof then exit for
%>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><TABLE id=Table40 cellSpacing=1 cellPadding=3 width=450
bgColor=#c6d7c6 border=0>
<TBODY>
<TR>
<TD colspan="2" bgColor=#f5faf5><TABLE cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD width="88%"><P style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px"><span class="text1" style="font-weight: bold"><%=selss("user")%></span> 留言于 <%=selss("data")%></P></TD>
<TD width="12%" align=right><a href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=selss("qq")%>" target="_blank">QQ</a> <a href="mailto:<%=selss("email")%>">邮件</a></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD width=50 bgColor=white><P class="text2" style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px">内容:</p></TD>
<TD width=385 bgColor=white><P style="MARGIN-TOP: 3px; MARGIN-LEFT: 10px"><%=selss("content")%></p></TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
<tr>
<td height="20">悔帆</td>
</tr>
</table>
<%
selss.movenext()
next
end if
%>
</ul>
<br>
<div class=fc align=center> 共<%=selss.pagecount%>页 每页10项 当前页<%=epage%>/<%=selss.pagecount%> <a
id=ctl03_hlFirstPage href="x.asp">首页</a>
<a id=ctl03_hlPrevPage
href="?page=<%=epage-1%>">上一页</a>
<a id=ctl03_hlNextPage
href="?page=<%=epage+1%>">下一页</a> <a
id=ctl03_hlLastPage
href="?page=<%=selss.pagecount%>">最后一页</a>
</div></td>
</tr>
</tbody>
</table>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="330" align="center"></td>
<td align="center"><a href="add.asp">填写留言</a></td>
<td align="center"><a href="admin.asp">管理留言</a></td>
</tr>
</table>
</body>
</html>
<%
selss.close
set selss=nothing
conn.close
set conn=nothing
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
dim i,intPage,page,pre,last,filepath
set rs = server.CreateObject("adodb.recordset")
sql="select * from wqyw order by id desc"
rs.PageSize = 1 '//(Yoko:这里设定每页显示的记录数
rs.CursorLocation = 3
rs.Open sql,conn,0,2,1 ' //(Yoko:'这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))
if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs.eof then
rs.AbsolutePage = intpage
end if
%>
<!--循环开始-->
<%
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then exit for
%>
..................
//(Yoko:要循环显示的内容 )..................
...................
<%
rs.movenext
next
%>
<!--循环体结束
分页部分:-->
<table width="99%" border="1" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs.pagecount > 0 then%>
<td width="13%" align="left">当前页<%=intpage%>/<%=rs.PageCount%></td>
<%else%>
<td width="41%" align="left">当前页0/0</td><%end if%>
<td width="46%" align="right"> <a href="本页.asp?page=1">首页<灶橡/a>|
<%if pre=true then%>
<a href="本页.asp?page=<%=intpage -1%>">上页</a>| <%end if%>
<%if last then%>
<a href="本页.asp?page=<%=intpage +1%>">下页</a> |<%end if%>孙晌
<a href="本页.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = intpage then%>
<option value="本页.asp?page=<%=i%>" selected><%=i%></option>
<%else%>隐凯旁
<option value="本页.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页</font>
</td>
</tr>
</table>
网上找的一般不能用 这是我自己改的
dim i,intPage,page,pre,last,filepath
set rs = server.CreateObject("adodb.recordset")
sql="select * from wqyw order by id desc"
rs.PageSize = 1 '//(Yoko:这里设定每页显示的记录数
rs.CursorLocation = 3
rs.Open sql,conn,0,2,1 ' //(Yoko:'这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))
if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs.eof then
rs.AbsolutePage = intpage
end if
%>
<!--循环开始-->
<%
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then exit for
%>
..................
//(Yoko:要循环显示的内容 )..................
...................
<%
rs.movenext
next
%>
<!--循环体结束
分页部分:-->
<table width="99%" border="1" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs.pagecount > 0 then%>
<td width="13%" align="left">当前页<%=intpage%>/<%=rs.PageCount%></td>
<%else%>
<td width="41%" align="left">当前页0/0</td><%end if%>
<td width="46%" align="right"> <a href="本页.asp?page=1">首页<灶橡/a>|
<%if pre=true then%>
<a href="本页.asp?page=<%=intpage -1%>">上页</a>| <%end if%>
<%if last then%>
<a href="本页.asp?page=<%=intpage +1%>">下页</a> |<%end if%>孙晌
<a href="本页.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = intpage then%>
<option value="本页.asp?page=<%=i%>" selected><%=i%></option>
<%else%>隐凯旁
<option value="本页.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页</font>
</td>
</tr>
</table>
网上找的一般不能用 这是我自己改的
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询