帮忙写个循环代码头

hailun 2006-12-29 05:12:13
就是类似于这样的
图片1 图片2 图片3
说明1 说明2 说明3

图片4 图片5 图片6
说明4 说明5 说明6
...全文
139 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hailun 2006-12-30
  • 打赏
  • 举报
回复
谢谢二位,有朋友再多写几个吗呵呵
现在已有答案了,就算是写"循环"灌水吧
plought 2006-12-29
  • 打赏
  • 举报
回复
<%
set rs=server.createobject("adodb.recordset")
sql="select * from honor"
rs.open sql,conn,1,1
%>
<TABLE width=600>
<%
IF not rs.eof() then
FOR ii=1 to rs.recordcount/3
%>
<TR>
<%
for jj=1 to 3
if (ii mod 2)<>0 then
%>
<TD><%=rs("图片")%></TD>
<%else%>
<TD><%=rs("说明")%></TD>
<%
end if
if rs.eof() then Exit for
rs.movenext
next
%>
</TR>
<%
if rs.eof() then Exit For
Next
End IF
%>
</TABLE>
<%rs.close %>



plought 2006-12-29
  • 打赏
  • 举报
回复
<%
set rs=server.createobject("adodb.recordset")
sql="select * from honor"
rs.open sql,conn,1,1
%>
<TABLE width=600>
<%
IF not rs.eof() then
FOR ii=1 to rs.recordcount/3
%>
<TR>
<%
for jj=1 to 3
if (ii mod 2)<>0 then
%>
<TD><%=rs("图片")%></TD>
<%else%>
<TD><%=rs("说明")%></TD>
<%
end if
if rs.eof() then Exit for
dovar=dovar+1
next
%>
</TR>
<%
if rs.eof() then Exit For
Next
End IF
%>
</TABLE>

<%
end if
rs.movenext
if rs.eof then
exit for
end if
i=i+1
next
rs.close
%>
</table>

hailun 2006-12-29
  • 打赏
  • 举报
回复
写出来了
<tr>
<td height="183" valign="top">
<table width="100%">

<tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from honor"
rs.open sql,conn,1,1
i=1
for a=1 to 3
%>
<td align="center">
<table align="center"><tr><td align="center"><img src=<%=rs("img")%> width="100"></td></tr>
<tr><td align="center"><%=rs("title")%></td></tr>
</table>
</td>
<%
j=i mod 3
if j=0 then
%>
</tr>
<%
end if
rs.movenext
if rs.eof then
exit for
end if
i=i+1
next
rs.close
%>
</table>
</td>
</tr>
</table></td>
</tr>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧