上次做了一个显示图片的,
显示8张,2行,4列,
不管够不够8张,都让它是2行,4列,不足的就会"你的位置"补齐
下面是我的代码,有些笨,谁有好一些的,也给发一下:
<table width="100%" border="0" cellspacing="9" cellpadding="0">
<%
for i=1 to 5
if rs.eof then exit for%>
<tr>
<% for j=1 to 2
if rs.eof then exit for %>
<td><table width="96" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #999999; ">
<tr>
<td width="204"><div align="center"><a href="<%=rs("url")%>" target="_blank" title="<%=rs("zhz")%>"><img src="<%=rs("logo")%>" width="95" height="40" border="0"></a></div></td>
</tr>
</table></td>
<% rs.movenext
next %>
<%
nber=rs.recordcount
c=2*i
b=c-nber
if b<>0 then
for a=1 to b
%>
<td><table width="96" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #999999; ">
<tr>
<td width="204"><div align="center"><a href="admin/jm.asp" target="_blank"><img src="images/nologo.jpg" alt="承德福达食品欢迎您加盟" width="95" height="40" border="0"></a></div></td>
</tr>
</table></td>
<% next
end if
%>
</tr>
<% next
%>
<%
fsize=8-rs.recordcount
fint=int(fsize/2)
if fsize mod 2=0 then
forsize=fint
else
forsize=fint+1
end if
for msize=1 to fint
%>
<tr>
<%
for m=1 to 2 %>
<td><table width="96" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #999999; ">
<tr>
<td width="204"><div align="center"><a href="admin/jm.asp" target="_blank"><img src="images/nologo.jpg" alt="承德福达食品欢迎您加盟" width="95" height="40" border="0"></a></div></td>
</tr>
</table></td>
<% next %>
</tr>
<% next
rsclose(rs) %>
</table>