初哥,第一次提问,大家关怀一下
sub ArticleContent(intTitleLen)
dim i,strTemp
i=0
do while not rsArticle.eof
strTemp= " "
strTemp= strTemp & " <table width=100% border=0 cellspacing=3 cellpadding=0> "
strTemp= strTemp & " <tr> "
strTemp= strTemp & " <td> <div align=center> "
strTemp= strTemp & " <a href=ArticleShow.asp?ArticleID= " & rsArticle( "articleid ") & "> "
strTemp= strTemp & " <img border=0 src= " & rsArticle( "DefaultPicUrl ") & " width=120 > "
strTemp= strTemp & " </a> </div> "
strTemp= strTemp & " </td> "
strTemp= strTemp & " </tr> "
strTemp= strTemp & " <td> <div align=center> "
strTemp= strTemp & " <a href=ArticleShow.asp?ArticleID= " & rsArticle( "articleid ") & "> " & rsArticle( "Title ") & " "
strTemp= strTemp & " </a> </div> "
strTemp = strTemp & " </table> "
response.write strTemp
rsArticle.movenext
i=i+1
if i> =MaxPerPage then exit do
loop
end sub
调用上面这段代码图片显示是一列多行的
1
2
3
4
我想让他是三列多行的
1 2 3
4 5 6
不知道要怎么循环
------解决方案--------------------先理解表格的tr td标签
循环的话,就是根据mod余数是否为3来加tr标签
------解决方案--------------------sub ArticleContent(intTitleLen)
dim i,strTemp
i=0
response.write " <table> <tr> "
do while not rsArticle.eof
strTemp= " "
strTemp= strTemp & " <table width=100% border=0 cellspacing=3 cellpadding=0> "
strTemp= strTemp & " <tr> "
strTemp= strTemp & " <td> <div align=center> "
strTemp= strTemp & " <a href=ArticleShow.asp?ArticleID= " & rsArticle( "articleid ") & "> "
strTemp= strTemp & " <img border=0 src= " & rsArticle( "DefaultPicUrl ") & " width=120 > "
strTemp= strTemp & " </a> </div> "
strTemp= strTemp & " </td> "
strTemp= strTemp & " </tr> "
strTemp= strTemp & " <td> <div align=center> "
strTemp= strTemp & " <a href=ArticleShow.asp?ArticleID= " & rsArticle( "articleid ") & "> " & rsArticle( "Title ") & " "
strTemp= strTemp & " </a> </div> "
strTemp = strTemp & " </table> "
response.write " <td> " & strTemp & " </td> "
If i Mod 3 = 0 Then response.write " </tr> <tr> "
rsArticle.movenext
i=i+1
if i> =MaxPerPage then exit do
Loop
response.