asp横向循环显示数据库内产品图片和名称

RT我想把数据库中的产品图片和名称横向循环显示,每行显示7个<tableclass="IPart1SortList"cellpadding="0"cellspacing=... RT我想把数据库中的产品图片和名称横向循环显示,每行显示7个
<table class="IPart1SortList" cellpadding="0" cellspacing="0" border="1" width="70"><tr><td align="center">
<% set rs=server.createobject("adodb.recordset")
sql="select top 20 * from Brand where classid in (select cstr(Classid) from Brandclass where upid=15) order by brandid desc "
rs.open sql,conn,1,1
for rsc=1 to 20
if not rs.eof then

%>
<% if trim(rs("logo"))<>"" then%>

</td></tr><tr><td align="center"> <a href="BrandInfo.asp?BrandID=<%=rs("brandid")%>" target="_blank" > <img src="<%=rs("logo")%>" alt="齐齐哈尔团购_<%=rs("name")%>" boder=1 width="141" height="102"/> <%=rs("name")%></a>
<%else%> </td></tr><tr><td align="center"><a href="BrandInfo.asp?BrandID=<%=BrandID%>" target="_blank" >

<img src="images/1.jpg" boder=0 width="141" height="102" border="1"/> <%=rs("name")%>
</a>
<%end if%><%
rs.movenext
if rsc=7 then
response.write("<br></br>")
end if
else
end if
next
rs.close
%>

</td>
</tr> </table>
如果我这样写 产品就是竖着循环的
请高手 回复代码
展开
 我来答
小猫笑我笑猫小
2010-05-19 · TA获得超过653个赞
知道小有建树答主
回答量:515
采纳率:0%
帮助的人:620万
展开全部
你在每个<td>中内嵌一个<table>就行了,<table>中放置每个产品的图片、名称即可,然后循环<td>就行了
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
古在舍2
推荐于2016-03-03 · TA获得超过170个赞
知道小有建树答主
回答量:154
采纳率:63%
帮助的人:95.7万
展开全部
<table>
<tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select top 20 * from Brand where classid in (select cstr(Classid) from Brandclass where upid=15) order by brandid desc "
rs.open sql,conn,1,1
Dim rsc,str1
rsc = 0
if not rs.eof then
Do While Not rs.eof
If rsc = 7 Then
response.write ("</tr><tr><td>" )
rsc = 1
Else
response.write ("<td>" )
rsc = rsc + 1
End If
if trim(rs("logo"))<>"" Then
%>
<a href="BrandInfo.asp?BrandID=<%=rs("brandid")%>" target="_blank" > <img src="<%=rs("logo")%>" alt="齐齐哈尔团购_<%=rs("name")%>" boder=1 width="141" height="102"/> <%=rs("name")%></a>
<%
else
%>
<a href="BrandInfo.asp?BrandID=<%=BrandID%>" target="_blank" ><img src="images/1.jpg" boder=0 width="141" height="102" border="1"/> <%=rs("name")%> </a>
<%
End If
response.write("</td>")
rs.movenext
Loop
End if
%>
</table>
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
hacker8848
2010-05-19 · TA获得超过169个赞
知道答主
回答量:316
采纳率:100%
帮助的人:177万
展开全部
去掉当中的</tr><tr>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式