北京香巴拉格尚装饰:关于ASP循环显示的问题!!大家帮我解决一下

来源:百度文库 编辑:高校问答 时间:2024/07/08 12:12:17
sub home_news_img()
set rs = conn.execute("select top 2 tp,bt,html from news where lbid in(1,2,3,4,5,6) and zt=1 and lx=1 order by id desc")
do while not rs.eof
Response.Write "<table width=100% border=0 cellspacing=0 cellpadding=3><tr><td align=center valign=middle height=85>"&_
"<a href=html/"&rs("html")&" target=_blank><img src="&rs("tp")&" width=120 height=75 border=0></a>"&_
"</td></tr></table><table width=95% border=0 cellspacing=0 cellpadding=0 align='center' style='TABLE-LAYOUT: fixed'><tr><td

height=21 align='center' style='LEFT: 0px; WIDTH: 100%; WORD-WRAP: break-word'>"&_
"<a href=html/"&rs("html")&" target=_blank>"&rs("bt")&"</a>"&_
"</TD></TR></TABLE>"
rs.movenext
loop
rs.close
set rs=nothing
end sub

如何让他们横向显示?

sub home_news_img()
set rs = conn.execute("select top 2 tp,bt,html from news where lbid in(1,2,3,4,5,6) and zt=1 and lx=1 order by id desc")
i=0
Response.Write "<table width=100% border=0 cellspacing=0 cellpadding=0>"
Response.Write "<tr>"
Response.Write "<td width=25%>"
do while not rs.eof
Response.Write "<table width=100% border=0 cellspacing=0 cellpadding=3><tr><td align=center valign=middle height=85>"&_
"<a href=html/"&rs("html")&" target=_blank><img src="&rs("tp")&" width=120 height=75 border=0></a>"&_
"</td></tr></table><table width=95% border=0 cellspacing=0 cellpadding=0 align='center' style='TABLE-LAYOUT: fixed'><tr><td

height=21 align='center' style='LEFT: 0px; WIDTH: 100%; WORD-WRAP: break-word'>"&_
"<a href=html/"&rs("html")&" target=_blank>"&rs("bt")&"</a>"&_
"</TD></TR></TABLE><td>"
i=i+1
if i mod 4 =0 then '4就是4列显示
response.Write("</tr>")
end if
rs.movenext
loop
Response.Write "</table>"
rs.close
set rs=nothing
end sub