注册 登录
编程论坛 ASP技术论坛

怎样将下面的循环成五列

dou521 发布于 2010-03-03 12:46, 370 次点击
现在循环出来的重复,还是行,很乱,没有积分了,请高手指点

sub ArticleContent(intTitleLen)
    dim i,strTemp
           i=1
              strTemp=""  
              strTemp= strTemp & "<table width=100% border=0 cellspacing=0 cellpadding=0>"
              strTemp= strTemp & "<tr>"
    do while not rsArticle.eof
    strTemp= strTemp & "<td>"
              strTemp= strTemp & "<a href=ProductShow.asp?ArticleID=" & rsArticle("articleid") & ">"
    fileExt=lcase(getFileExtName(rsArticle("DefaultPicUrl")))
    strTemp= strTemp & "</td></tr>"
              strTemp= strTemp & "<tr><td><a href=ArticleShow.asp?ArticleID=" & rsArticle("articleid") & ">" & rsArticle("Title") & "</a>"
               strTemp= strTemp & "</td>"
                    if i mod 5= 0 then
          strTemp= strTemp & "</tr>"
          end if
                    rsArticle.movenext
                    i=i+1
                    strTemp= strTemp & "</table>"
  response.write strTemp
  if i>=15 then exit do
 loop
end sub

[ 本帖最后由 dou521 于 2010-3-3 19:47 编辑 ]
1 回复
#2
icecool2010-03-04 21:05
看一下下面的代码自已体会:

<table width="12%" height="102" border="1" cellpadding="0" cellspacing="0">
<tr>

<%
i=0
do while not i>=20
 %>


<td width=25%><center><%=i%></center></td>
<% i=i+1 %>
<%if i mod 3=0 then %>
    </tr>
<% end if %>
 
<%
loop  
%>
</table>
1