关于ASP循环表格的问题之解答

很多时候,我们采用原始的方法来解决一行内循环3张图片,如果上传者只上传了2张图片,那么2张图片间的距离会很大,因为缺少了一个<td>&nbsp;</td>.


<table border="0" cellpadding="0" cellspacing="0">
<%
dim rs,sqltext
set rs = Server.CreateObject("adodb.recordset")
sqltext="select * from [bigclass]"
rs.Open sqltext,conn,1,1
m=1
colzs=5 '一行显示5列
if rs.RecordCount mod colzs=0 then
rowzs=int(rs.RecordCount/colzs)
else
rowzs=int(rs.RecordCount/colzs)+1
end if
for j = 1 to rowzs%>
<tr>
<%for i = 1 to colzs%>
<%if not rs.EOF then%>
<td><input type="checkbox" name="qxflag<%=m%>" value="1"><%=trim(rs("bigname"))%></td>
<%
rs.MoveNext
m = m + 1
else
%>
<td> </td>
<%end if%>
<%next%>
</tr>
<%
next
rs.Close
set rs = nothing
%>
</table>

原文地址:https://www.cnblogs.com/zerogo/p/2209113.html