asp中循环输出,出现问题!!!!求助!!!! 50

asp循环输出时,我想让它一行5个图片但是代码运行起来后不知道为什么图片都靠左边一竖排一来,不知道是怎么回事请大家帮帮忙啊!由于百度发言有字数限制所以只发出图片循环这一部... asp循环输出时,我想让它一行5个图片但是代码运行起来后不知道为什么图片都靠左边一竖排一来,不知道是怎么回事请大家帮帮忙啊!
由于百度发言有字数限制所以只发出图片循环这一部份的代码 这是我的QQ:420064415

代码如下;

<%
dim r
dim j
dim k
dim row
r=0
do while not rs.eof and rowcount > 0
if r mod 5=0 then
row="<tr>"
else
row=" "
end if
r=r+1
response.write("<TABLE height=108 cellSpacing=0 cellPadding=0 width=129 border=0 background='images/sg_dt_1.gif'>")
response.write("<TR>")
response.write(rom)
response.write("<TD vAlign=bottom height=7></TD>")
response.write("</TR>")
response.write("<TR>")
response.write("<TD height=78 align='center' valign='middle'>")
response.write("<DIV align=center><a target=_blank href=photoview.asp?id=" & rs("id") & "><DIV align=center><img width=110 height=78 border=0 src=uploadimg/" & rs("url") & "></a></DIV></TD>")
'response.write("<td width=100 class=ziti2 align=center>" & "<a target=_blank href=photoview.asp?id=" & rs("id") & "><img width=120 height=100 border=0 src=uploadimg/" & rs("url") & "></a><p>")
response.write("</TR>")
response.write("<TR>")
response.write("<TD height=10>")
response.write("<DIV align=center>"&rs("name")&"</DIV></TD>")
' response.write("<td width=100 align=left background='images/sg_dt_1.gif'>" & "<a target=_blank href=photoview.asp?id=" & rs("id") & "><DIV align=center><img width=110 height=78 border=0 src=uploadimg/" & rs("url") & "></a><p>")
'response.write(rs("name"))
response.write("</TR>")
response.write("</TABLE>")
rowcount=rowcount-1
rs.MoveNext
Loop
'wend
end if
end if
rs.close
set rs=nothing

%>
</table
图片后面是有背景的
background='images/sg_dt_1.gif'>")

您刚才的代码怎么解决背景的问题????
展开
 我来答
liu_binq63
2006-11-14 · TA获得超过1485个赞
知道大有可为答主
回答量:1881
采纳率:0%
帮助的人:2275万
展开全部
这么写代码太乱了。
response.write("<TD height=78 align='center' valign='middle'>")
response.write("<DIV align=center><a target=_blank href=photoview.asp?id=" & rs("id") & "><DIV align=center><img width=110 height=78 border=0 src=uploadimg/" & rs("url") & "></a></DIV></TD>")
只需要循环这一段就行了。代码如下:
r=0
do while not rs.eof and rowcount > 0
if r mod 5=0 then
if r=0 then
row="<tr>"
response.write("<tr>")
rowend=" "
else
row="<tr>"
rowend="</tr>"
end if
else
row=" "
rowend=" "
end if

r=r+1
response.write(rowend)
response.write("<TD height=78 align='center' valign='middle'>")
response.write("<DIV align=center><a target=_blank href=photoview.asp?id=" & rs("id") & "><DIV align=center><img width=110 height=78 border=0 src=uploadimg/" & rs("url") & "></a></DIV></TD>")
response.write(row)
rowcount=rowcount-1
rs.MoveNext
loop
if r mod 5<>0 then
response.write("</tr>")
end if
最好这样:

<table background="images/sg_dt_1.gif">
<%
do

%>

<tr>
<%
for i=0 to 4

%>
<td>
<DIV align=center><a target=_blank href=photoview.asp?id=<%=rs("id")%>><DIV align=center><img width=110 height=78 border=0 src=uploadimg/<%=rs(url)%>></a></DIV>
</td>
<%
rs.movenext
if rs.eof then exit do
next
%>
</tr>
<%
loop
%>
</table>
沁峰冲压机器人自动化
2006-11-20 · 超过23用户采纳过TA的回答
知道答主
回答量:89
采纳率:0%
帮助的人:60.2万
展开全部
呵呵。.我以前也遇到过这种问题。. 你定义的ROW根本就没用到呀。.. 晕..
你应该在 do while not rs.eof and rowcount > 0 这个循环里面用到它.否则是没用的了。.我每次都是用下面这种方法实现的。你看看.希望对你有所帮助.
<table> 外部表格
<tr>
dim num=0
do while not rs.eof
num=num+1
<td width=20%> '每行输出5个所以是20%
<table width=100%>
<tr>
<td background="你的背景地址">
</td>
</tr>
</table>
</td>
if num mod 5=0 then response.write"</tr><tr>"
rs.movenext
loop
rs.close
</tr>
</table>

如果还有什么不明白的地方。我的邮箱bicyer@163.com 我们一起探讨
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
骇客克星
2006-11-14 · TA获得超过211个赞
知道小有建树答主
回答量:1557
采纳率:0%
帮助的人:890万
展开全部
你这是循环了行数。
改一下吧。要循环<td></td>这里的.如楼上的写法。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
一碑电影
2006-11-14 · 知道合伙人影视综艺行家
一碑电影
知道合伙人影视综艺行家
采纳数:406 获赞数:5429
微信公众号:一碑电影。 电影,延长三倍人生。

向TA提问 私信TA
展开全部
从你的代码可以看出,你是先用Tr确定一行,然后在这一行里划了五个表,每一个表里填一副图片,但是我观察了你的一个Tr里没有Td,也就是五个表全在一个行里,每一个表你也设定了宽和高,极有可能是你的五个表加起来的宽度超了你的最早的那个行宽,你仔细检查一下吧.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式