驻外招聘业务:帮我看一下我的ASP代码图片排列为什么不正确

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 00:41:16
代码如下,我想实现一行排列3个图片,我加了三个产品后但运行后排列的却是这样排列:
1
1 2
1 2 3

各位高手帮忙看一下我哪里写得不对了!
sub ArticleContent(intTitleLen)
dim i,strTemp
strTemp=""
strTemp= strTemp & "<table width=100% border=0 cellspacing=3 cellpadding=0>"
do while not rsArticle.eof
i=0
for i=1 to 3 strTemp= strTemp & "<td width=25% align=center rowspan=5>"
strTemp= strTemp & "<div align=center><a href=ArticleShow.asp?ArticleID=" & rsArticle("articleid") & ">"
strTemp= strTemp & "<img border=0 src=" & rsArticle("DefaultPicUrl") & " width=110 height=120>"
strTemp= strTemp & "</a></div>"
strTemp= strTemp & "Item name:"
strTemp= strTemp & "<a href=ArticleShow.asp?ArticleID=" & rsArticle("articleid") & ">" & rsArticle("Title") & ""
strTemp= strTemp & "</a></td>"
strTemp= strTemp &"<td colspan=2>"
strTemp= strTemp & "<td width=12% height=18>"
strTemp= strTemp & "</td>"
strTemp= strTemp & "</td>"
response.write strTemp
rsArticle.movenext
i=i+1
next
if i>=MaxPerPage then exit do
loop
strTemp= strTemp & "</table>"
end sub
楼下的atchoo,能帮我整理一下这些代码吗?怎么样才能正常排列,不知道是不是我的循环写错了,总是排列成
1
1 2
1 2 3
正常排列应该
1 2 3

谢谢你这么热心,我加你QQ了,就等你验证了

整个表格的结构乱七八糟,你的<TR>在哪?还有
strTemp= strTemp &"<td colspan=2>"
strTemp= strTemp & "<td width=12% height=18>"
strTemp= strTemp & "</td>"
strTemp= strTemp & "</td>"
这是什么意思,<td>的嵌套吗?

如果只循环一次那么你的表格结构就是:
<table>
<td></td><td><td></td></td> <!--循环三次-->
</table>

这能正常显示吗?

还有,本来就是for i=1 to 3,后面怎么还有这个:i=i+1
这什么哟,一个字,乱啊

要达到你说的效果可以这样写:
<table>
<%do while not rsArticle.eof%>
<tr>
<%for i=1 to 3
response.write "<td>"&rsArticle("articleid") &"</td>"
rsArticle.movenext
next%>
</tr>
<%loop%>
</table>

QQ聊吧:22670595 注明table