基于下面这段一行三列asp代码(下面的代码是我简化的,源代码编译效果如图),如何添加一段分页显示代码?
<!--#includefile="conn.asp"--><html><head><title>二手咖啡机市场!!</title><style>td{font-size...
<!--#include file="conn.asp"-->
<html>
<head>
<title>二手咖啡机市场!!</title>
<style>
td{ font-size:12px;}
.a4{color:#FFFFFF;text-decoration:none;}
.a4:hover{color:yellow; text-decoration:underline;}
.STYLE4 {
font-size: 24px;
color: #FFFFFF;
}
</style>
</head>
<body>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select Top 9 * from [Second-hand] order by sId desc",conn,1,1
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="border-top:#cccccc 1px solid;border-right:#cccccc 1px solid;border-left:#cccccc 1px solid;border-bottom:#cccccc 1px solid">
<tr>
<td height="5"></td>
</tr>
<tr>
<%
if rs.eof then
%>
<td width="226" valign="top" align="left" bgcolor="#FFFFFF">
<div align="center">
对不起,暂无二手机信息发布!<br>
</div>
</td>
<%end if
i=0
do while not rs.eof
i=i+1
%>
<td align="left" bgcolor="#FFFFFF">
<table border="0" align="center" cellpadding="1" cellspacing="0" width="255px" style=" margin-bottom:10px;">
<tr>
<td valign="bottom">
<div align="center">
<table cellspacing=0 cellpadding=0 width="252" height="100%" style="border:#993300 1px solid;">
<tr>
<td colspan="4"><%=rs("sName")%></td>
</tr>
<tr>
<td colspan="2" height="2px"></td>
</tr>
<tr>
<td width=82 height=102 align=center style="border-right:#993300 1px dashed;">
<%if rs("sImgPath")="" then
response.write "<div align=center><a href=list.asp?id="&rs("sId")&" ><img src='../qdjy/images/emptybook.gif' width=90 height=90 border=0></a></div>"
else%>
<a href=list.asp?id=<%=rs("sId")%> ><img src="<%=rs("sImgPath")%>" alt="点击查看详细信息" width=80 height=80 border=0 align=absmiddle></a>
<%end if%> </td>
<td width="169" valign=middle style="padding-left: 6px">
<table cellspacing=0 cellpadding=0 width="162" height="110">
<tr>
<td valign="center">
电压/功率:<%=rs("sVo")&"v/"&rs("sPo")&"w")%>
</td>
</tr>
<tr>
<td>长/宽/高:<%=rs("sLength")&"/"&rs("sWide")&"/"&rs("sHight")&"cm")%></td>
</tr>
<tr>
<td>重量:<%=rs("sWeight")&"kg"%></td>
</tr>
<tr>
<td>水泵压力:<%=rs("sPr")&"bar"%></td>
</tr>
<tr>
<td height="22">价格:<%=formatnumber(rs("sPrice"),2)&"元"%></td>
</tr>
</table> </td>
</tr>
<tr>
<td colspan="2">简述:<%=rs("sSummary"))%></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<%
if (i mod 3=0) and i>=3 then
%>
</tr>
<tr>
<%
end if
if i>=12 then exit do end if
rs.movenext
loop
rs.close
%>
</tr>
<tr>
<td height="5"></td>
</tr>
</table>
<%
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>
要是解决了,我追加50分。要有解释的。
不行啊,看看下面的图~ 展开
<html>
<head>
<title>二手咖啡机市场!!</title>
<style>
td{ font-size:12px;}
.a4{color:#FFFFFF;text-decoration:none;}
.a4:hover{color:yellow; text-decoration:underline;}
.STYLE4 {
font-size: 24px;
color: #FFFFFF;
}
</style>
</head>
<body>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select Top 9 * from [Second-hand] order by sId desc",conn,1,1
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="border-top:#cccccc 1px solid;border-right:#cccccc 1px solid;border-left:#cccccc 1px solid;border-bottom:#cccccc 1px solid">
<tr>
<td height="5"></td>
</tr>
<tr>
<%
if rs.eof then
%>
<td width="226" valign="top" align="left" bgcolor="#FFFFFF">
<div align="center">
对不起,暂无二手机信息发布!<br>
</div>
</td>
<%end if
i=0
do while not rs.eof
i=i+1
%>
<td align="left" bgcolor="#FFFFFF">
<table border="0" align="center" cellpadding="1" cellspacing="0" width="255px" style=" margin-bottom:10px;">
<tr>
<td valign="bottom">
<div align="center">
<table cellspacing=0 cellpadding=0 width="252" height="100%" style="border:#993300 1px solid;">
<tr>
<td colspan="4"><%=rs("sName")%></td>
</tr>
<tr>
<td colspan="2" height="2px"></td>
</tr>
<tr>
<td width=82 height=102 align=center style="border-right:#993300 1px dashed;">
<%if rs("sImgPath")="" then
response.write "<div align=center><a href=list.asp?id="&rs("sId")&" ><img src='../qdjy/images/emptybook.gif' width=90 height=90 border=0></a></div>"
else%>
<a href=list.asp?id=<%=rs("sId")%> ><img src="<%=rs("sImgPath")%>" alt="点击查看详细信息" width=80 height=80 border=0 align=absmiddle></a>
<%end if%> </td>
<td width="169" valign=middle style="padding-left: 6px">
<table cellspacing=0 cellpadding=0 width="162" height="110">
<tr>
<td valign="center">
电压/功率:<%=rs("sVo")&"v/"&rs("sPo")&"w")%>
</td>
</tr>
<tr>
<td>长/宽/高:<%=rs("sLength")&"/"&rs("sWide")&"/"&rs("sHight")&"cm")%></td>
</tr>
<tr>
<td>重量:<%=rs("sWeight")&"kg"%></td>
</tr>
<tr>
<td>水泵压力:<%=rs("sPr")&"bar"%></td>
</tr>
<tr>
<td height="22">价格:<%=formatnumber(rs("sPrice"),2)&"元"%></td>
</tr>
</table> </td>
</tr>
<tr>
<td colspan="2">简述:<%=rs("sSummary"))%></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<%
if (i mod 3=0) and i>=3 then
%>
</tr>
<tr>
<%
end if
if i>=12 then exit do end if
rs.movenext
loop
rs.close
%>
</tr>
<tr>
<td height="5"></td>
</tr>
</table>
<%
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>
要是解决了,我追加50分。要有解释的。
不行啊,看看下面的图~ 展开
2个回答
展开全部
<!--#include file="conn.asp"-->
<html>
<head>
<title>二手咖啡机市场!!</title>
<style>
td{ font-size:12px;}
.a4{color:#FFFFFF;text-decoration:none;}
.a4:hover{color:yellow; text-decoration:underline;}
.STYLE4 {
font-size: 24px;
color: #FFFFFF;
}
</style>
</head>
<body>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select Top 9 * from [Second-hand] order by sId desc",conn,1,1
PageSize=10
Rs.PageSize=PageSize
RecordCount=Rs.RecordCount
PageNo=Request("PageNo")
if PageNo="" then
PageNo=1
elseif PageNo<=0 then
PageNo=1
else
PageNo=cint(PageNo)
if PageNo>rs.PageCount then PageNo=rs.PageCount
end if
Rs.AbsolutePage=cint(PageNo)
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="border-top:#cccccc 1px solid;border-right:#cccccc 1px solid;border-left:#cccccc 1px solid;border-bottom:#cccccc 1px solid">
<tr>
<td height="5"></td>
</tr>
<tr>
<%
if rs.eof then
%>
<td width="226" valign="top" align="left" bgcolor="#FFFFFF">
<div align="center">
对不起,暂无二手机信息发布!<br>
</div>
</td>
<%end if
i=0
do while not rs.eof
i=i+1
%>
<td align="left" bgcolor="#FFFFFF">
<table border="0" align="center" cellpadding="1" cellspacing="0" width="255px" style=" margin-bottom:10px;">
<tr>
<td valign="bottom">
<div align="center">
<table cellspacing=0 cellpadding=0 width="252" height="100%" style="border:#993300 1px solid;">
<tr>
<td colspan="4"><%=rs("sName")%></td>
</tr>
<tr>
<td colspan="2" height="2px"></td>
</tr>
<tr>
<td width=82 height=102 align=center style="border-right:#993300 1px dashed;">
<%if rs("sImgPath")="" then
response.write "<div align=center><a href=list.asp?id="&rs("sId")&" ><img src='../qdjy/images/emptybook.gif' width=90 height=90 border=0></a></div>"
else%>
<a href=list.asp?id=<%=rs("sId")%> ><img src="<%=rs("sImgPath")%>" alt="点击查看详细信息" width=80 height=80 border=0 align=absmiddle></a>
<%end if%> </td>
<td width="169" valign=middle style="padding-left: 6px">
<table cellspacing=0 cellpadding=0 width="162" height="110">
<tr>
<td valign="center">
电压/功率:<%=rs("sVo")&"v/"&rs("sPo")&"w")%>
</td>
</tr>
<tr>
<td>长/宽/高:<%=rs("sLength")&"/"&rs("sWide")&"/"&rs("sHight")&"cm")%></td>
</tr>
<tr>
<td>重量:<%=rs("sWeight")&"kg"%></td>
</tr>
<tr>
<td>水泵压力:<%=rs("sPr")&"bar"%></td>
</tr>
<tr>
<td height="22">价格:<%=formatnumber(rs("sPrice"),2)&"元"%></td>
</tr>
</table> </td>
</tr>
<tr>
<td colspan="2">简述:<%=rs("sSummary"))%></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<%
if (i mod 3=0) and i>=3 then
%>
</tr>
<tr>
<%
end if
if i>=12 then exit do end if
rs.movenext
loop
rs.close
%>
</tr>
<tr>
<td height="5"></td>
</tr>
</table>
<a href="?PageNo=1">首页</a> <%if PageNo>1 then%><a href="?PageNo=<%=PageNo-1%>">上页</a><%else%>上页<%end if%>
<%for i=0 to PageSize-1%>
<%if PageNo+1>=int(PageNo/PageSize)*PageSize then%><a href="?PageNo=<%=int(PageNo/PageSize)*PageSize+i%>">[<%=int(PageNo/PageSize)*PageSize+i%>]</a><%end if%>
<%next%>
<%if PageNo+1<Rs.PageCount+1 then%><a href="?PageNo=<%=PageNo+1%>">下页</a><%else%>下页<%end if%> <a href="?PageNo=<%=Rs.PageCount%>">尾页</a>
<input type="text" name="pageno" value=""><input type="submit" name="submit" value="转到页面">
<%
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>
<html>
<head>
<title>二手咖啡机市场!!</title>
<style>
td{ font-size:12px;}
.a4{color:#FFFFFF;text-decoration:none;}
.a4:hover{color:yellow; text-decoration:underline;}
.STYLE4 {
font-size: 24px;
color: #FFFFFF;
}
</style>
</head>
<body>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select Top 9 * from [Second-hand] order by sId desc",conn,1,1
PageSize=10
Rs.PageSize=PageSize
RecordCount=Rs.RecordCount
PageNo=Request("PageNo")
if PageNo="" then
PageNo=1
elseif PageNo<=0 then
PageNo=1
else
PageNo=cint(PageNo)
if PageNo>rs.PageCount then PageNo=rs.PageCount
end if
Rs.AbsolutePage=cint(PageNo)
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="border-top:#cccccc 1px solid;border-right:#cccccc 1px solid;border-left:#cccccc 1px solid;border-bottom:#cccccc 1px solid">
<tr>
<td height="5"></td>
</tr>
<tr>
<%
if rs.eof then
%>
<td width="226" valign="top" align="left" bgcolor="#FFFFFF">
<div align="center">
对不起,暂无二手机信息发布!<br>
</div>
</td>
<%end if
i=0
do while not rs.eof
i=i+1
%>
<td align="left" bgcolor="#FFFFFF">
<table border="0" align="center" cellpadding="1" cellspacing="0" width="255px" style=" margin-bottom:10px;">
<tr>
<td valign="bottom">
<div align="center">
<table cellspacing=0 cellpadding=0 width="252" height="100%" style="border:#993300 1px solid;">
<tr>
<td colspan="4"><%=rs("sName")%></td>
</tr>
<tr>
<td colspan="2" height="2px"></td>
</tr>
<tr>
<td width=82 height=102 align=center style="border-right:#993300 1px dashed;">
<%if rs("sImgPath")="" then
response.write "<div align=center><a href=list.asp?id="&rs("sId")&" ><img src='../qdjy/images/emptybook.gif' width=90 height=90 border=0></a></div>"
else%>
<a href=list.asp?id=<%=rs("sId")%> ><img src="<%=rs("sImgPath")%>" alt="点击查看详细信息" width=80 height=80 border=0 align=absmiddle></a>
<%end if%> </td>
<td width="169" valign=middle style="padding-left: 6px">
<table cellspacing=0 cellpadding=0 width="162" height="110">
<tr>
<td valign="center">
电压/功率:<%=rs("sVo")&"v/"&rs("sPo")&"w")%>
</td>
</tr>
<tr>
<td>长/宽/高:<%=rs("sLength")&"/"&rs("sWide")&"/"&rs("sHight")&"cm")%></td>
</tr>
<tr>
<td>重量:<%=rs("sWeight")&"kg"%></td>
</tr>
<tr>
<td>水泵压力:<%=rs("sPr")&"bar"%></td>
</tr>
<tr>
<td height="22">价格:<%=formatnumber(rs("sPrice"),2)&"元"%></td>
</tr>
</table> </td>
</tr>
<tr>
<td colspan="2">简述:<%=rs("sSummary"))%></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<%
if (i mod 3=0) and i>=3 then
%>
</tr>
<tr>
<%
end if
if i>=12 then exit do end if
rs.movenext
loop
rs.close
%>
</tr>
<tr>
<td height="5"></td>
</tr>
</table>
<a href="?PageNo=1">首页</a> <%if PageNo>1 then%><a href="?PageNo=<%=PageNo-1%>">上页</a><%else%>上页<%end if%>
<%for i=0 to PageSize-1%>
<%if PageNo+1>=int(PageNo/PageSize)*PageSize then%><a href="?PageNo=<%=int(PageNo/PageSize)*PageSize+i%>">[<%=int(PageNo/PageSize)*PageSize+i%>]</a><%end if%>
<%next%>
<%if PageNo+1<Rs.PageCount+1 then%><a href="?PageNo=<%=PageNo+1%>">下页</a><%else%>下页<%end if%> <a href="?PageNo=<%=Rs.PageCount%>">尾页</a>
<input type="text" name="pageno" value=""><input type="submit" name="submit" value="转到页面">
<%
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>
参考资料: http://www.51wisdom.com.cn/html/2250.html
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询