asp循环问题,高手进

来源:百度知道 编辑:UC知道 时间:2024/05/07 10:44:37
我做了一个循环如下

<%i=1
set showxc_photoname=conn.execute("select*from xc_photoname where name='"&session("name")&"' order by id desc")
do while not showxc_photoname.eof
%>
<table width="185" height="166" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#E7E7E7">
<tr>
<td height="143"><div align="center"></div></td>
</tr>
<tr>
<td><div align="center">[<%=showxc_photoname("title")%>]</div></td>
</tr>
</table>
<%i=i+1
if i>5 then exit do
showxc_photoname.movenext
Loop
showxc_photoname.Close
set showxc_photoname=nothing
%>

显示出来的时候,表格都是竖排的,能不能修改成横排显示 一行显示5个呢?

<table width="185" height="166" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#E7E7E7">
<tr>
<td height="143"><div align="center"></div></td>
</tr>
<tr>
<%i=1
set showxc_photoname=conn.execute("select*from xc_photoname where name='"&session("name")&"' order by id desc")
do while not showxc_photoname.eof
%>
<td><div align="center">[<%=showxc_photoname("title")%>]</div></td>
<%i=i+1
if (i mod 5)=0 then Response.Write "</tr><tr>"
showxc_photoname.movenext
Loop
showxc_photoname.Close
set showxc_photoname=nothing
%>

</tr>
</table>

<table width="185" height="166