您的位置:首页 > 编程语言 > ASP

关于ASP循环表格的问题之解答[比较详细]

2008-11-05 00:00 232 查看
下面是代码,如果看不懂,建议先把表格的一些<tr><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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: