循环表格的方法
发一些代码,我想大家会用的上的,
如题:
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="4">
<% 'do while not rs.eof 'and ipage<rs.pagesize
for i=1 to 5
if rs.eof then exit for%>
<tr>
<% for j=1 to 4
if rs.eof then exit for
%>
<td height="120">
<table width="100%" border="1" cellpadding="0" cellspacing="3" bordercolor="#888888">
<tr>
<td><div align="center"><a href="look.asp?id=<%=rs("id")%>" target="_blank"><img src="showimg.asp?id=<%=rs(0)%>" width="164" height="112" border="0" onload="javascript:DrawImage(this);"></a></div></td>
</tr>
<tr>
<td height="20"><div align="center">名称:<%= rs("name") %>|次数:<%= rs("dj") %> </div></td>
</tr>
</table>
</td>
<%
rs.movenext
next %>
<%
'response.Write i
if page=1 then
cout=rs.recordcount
else
cout=rs.recordcount-rs.pagesize*(page-1)
end if
c=4*i
b=c-cout
'response.Write b
if b<>0 then
for a=1 to b
'if (b+i)>4 then exit for%>
<td height="120">
<table width="100%" border="1" cellpadding="0" cellspacing="3" bordercolor="#888888">
<tr>
<td><div align="center"><img src="no.gif" width="164" height="112" border="0" onload="javascript:DrawImage(this);"></div></td>
</tr>
<tr>
<td height="20"><div align="center">暂无</div></td>
</tr>
</table>
</td>
<% next
end if%>
</tr>
<%
next
'ipage=ipage+1
'loop%>
</table>
看看效果图会更明显些!!
[此贴子已经被作者于2005-5-18 9:50:41编辑过]