asp双循环问题。
asp双循环问题。我想每页显示八条记录。然后八条记录中,每两条记录换一行。请高手解答。这是我处理的代码,没有实现想要的效果:<tablewidth="100%"borde...
asp双循环问题。我想每页显示八条记录。然后八条记录中,每两条记录换一行。请高手解答。
这是我处理的代码,没有实现想要的效果:
<table width="100%" border="0" cellspacing="0" height="150">
<%
sqlt="select * from cpzs where firstImageName<>'' order by id desc"
set rsgs=server.createobject("ADODB.Recordset")
rsgs.open sqlt,conn,1,1
do while not rsgs.eof
%>
<%
rsgs.PageSize=8
if page=0 then page=1
pages=rsgs.pagecount
if page > pages then page=pages
rsgs.AbsolutePage=page
for h=1 to rsgs.PageSize
%>
<%
j=0
do while not rsgs.eof
if j=0 then
response.write "<tr>"
end if
j=j+1
%>
<td valign="top">
<div>
这里是要显示的单条内容
</div>
</td>
<%
if j=2 then
response.write "</tr>"
j=0
end if
rsgs.movenext
loop
%>
<%
rsgs.movenext
if rsgs.eof then exit for
next
%>
</table>
<div align="center"></div>
<table width="97%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="vedio_works_link" align="center">
<form method=Post action="vedio.asp">
<%if Page<2 then
response.write "首页 上一页 "
else
response.write "<a href=vedio.asp?page=1>首页</a> "
response.write "<a href=vedio.asp?page=" & Page-1 & ">上一页</a> "
end if
if rsgs.pagecount-page<1 then
response.write "下一页 尾页"
else
response.write "<a href=vedio.asp?page=" & (page+1) & ">"
response.write "下一页</a> <a href=vedio.asp?page="&rsgs.pagecount&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&Page&"</font>/"&rs.pagecount&"</strong>页 "
response.write " 共<b><font color='#FF0000'>"&rsgs.recordcount&"</font></b>条记录 <b>"&rsgs.pagesize&"</b>条记录/页"
response.write " 转到第<input type='text' name='page' size=4 maxlength=10 class=input value="&page&">页"
response.write " <input class=input type='submit' value='确定' name='cndok'></span></p>"
%>
</form></td>
</tr>
</table>
<%
rsgs.movenext
loop
rsgs.Close
set rsgs=nothing
%>
</td>
</tr>
</table> 展开
这是我处理的代码,没有实现想要的效果:
<table width="100%" border="0" cellspacing="0" height="150">
<%
sqlt="select * from cpzs where firstImageName<>'' order by id desc"
set rsgs=server.createobject("ADODB.Recordset")
rsgs.open sqlt,conn,1,1
do while not rsgs.eof
%>
<%
rsgs.PageSize=8
if page=0 then page=1
pages=rsgs.pagecount
if page > pages then page=pages
rsgs.AbsolutePage=page
for h=1 to rsgs.PageSize
%>
<%
j=0
do while not rsgs.eof
if j=0 then
response.write "<tr>"
end if
j=j+1
%>
<td valign="top">
<div>
这里是要显示的单条内容
</div>
</td>
<%
if j=2 then
response.write "</tr>"
j=0
end if
rsgs.movenext
loop
%>
<%
rsgs.movenext
if rsgs.eof then exit for
next
%>
</table>
<div align="center"></div>
<table width="97%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="vedio_works_link" align="center">
<form method=Post action="vedio.asp">
<%if Page<2 then
response.write "首页 上一页 "
else
response.write "<a href=vedio.asp?page=1>首页</a> "
response.write "<a href=vedio.asp?page=" & Page-1 & ">上一页</a> "
end if
if rsgs.pagecount-page<1 then
response.write "下一页 尾页"
else
response.write "<a href=vedio.asp?page=" & (page+1) & ">"
response.write "下一页</a> <a href=vedio.asp?page="&rsgs.pagecount&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&Page&"</font>/"&rs.pagecount&"</strong>页 "
response.write " 共<b><font color='#FF0000'>"&rsgs.recordcount&"</font></b>条记录 <b>"&rsgs.pagesize&"</b>条记录/页"
response.write " 转到第<input type='text' name='page' size=4 maxlength=10 class=input value="&page&">页"
response.write " <input class=input type='submit' value='确定' name='cndok'></span></p>"
%>
</form></td>
</tr>
</table>
<%
rsgs.movenext
loop
rsgs.Close
set rsgs=nothing
%>
</td>
</tr>
</table> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询