asp循环语句怎么写
下面代码读出10条数据,怎么让它成为2行。每行显示5条?subdisk_top(n_num,c_num)response.writevbcrlf&music_bar_to...
下面代码读出10条数据,怎么让它成为2行。每行显示5条?
sub disk_top(n_num,c_num)
response.write vbcrlf&music_bar_top("left_disk_good",0)
n_name="专辑"
sql="select top 10 name,pic,hits,id from music_disk where hidden=1 order by id desc"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
n_topic=rs("name")
pic=rs("pic")
n_topic=joekoe_cms.code_js(n_topic,1)
response.write "<table><tr>" & _
vbcrlf&"<td align=right class=tims>"&"<img src='"&rs("pic")&"'width='120' border='0'>""</td>" &_
vbcrlf&"</tr><tr>"&_
vbcrlf&"<td ><a href='javascript:;' onclick=javascript:open_view('music_disk_view.asp?id="&rs("id")&"',1); alt='浏览专辑:"&joekoe_cms.code_html(n_topic,1,0)&"'>"&joekoe_cms.code_html(n_topic,1,c_num)&"</a></td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"</table>"
rs.movenext
loop
rs.close
response.write vbcrlf&music_bar_end()
end sub
二楼说的没用啊?加上了还是那样没效果。 展开
sub disk_top(n_num,c_num)
response.write vbcrlf&music_bar_top("left_disk_good",0)
n_name="专辑"
sql="select top 10 name,pic,hits,id from music_disk where hidden=1 order by id desc"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
n_topic=rs("name")
pic=rs("pic")
n_topic=joekoe_cms.code_js(n_topic,1)
response.write "<table><tr>" & _
vbcrlf&"<td align=right class=tims>"&"<img src='"&rs("pic")&"'width='120' border='0'>""</td>" &_
vbcrlf&"</tr><tr>"&_
vbcrlf&"<td ><a href='javascript:;' onclick=javascript:open_view('music_disk_view.asp?id="&rs("id")&"',1); alt='浏览专辑:"&joekoe_cms.code_html(n_topic,1,0)&"'>"&joekoe_cms.code_html(n_topic,1,c_num)&"</a></td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"</table>"
rs.movenext
loop
rs.close
response.write vbcrlf&music_bar_end()
end sub
二楼说的没用啊?加上了还是那样没效果。 展开
展开全部
循环部分改为:
i=0
do while not rs.eof
i=i+1
n_topic=rs("name")
pic=rs("pic")
n_topic=joekoe_cms.code_js(n_topic,1)
response.write "<table><tr>" & _
vbcrlf&"<td align=right class=tims>"&"<img src='"&rs("pic")&"'width='120' border='0'>""</td>" &_
vbcrlf&"</tr><tr>"&_
vbcrlf&"<td ><a href='javascript:;' onclick=javascript:open_view('music_disk_view.asp?id="&rs("id")&"',1); alt='浏览专辑:"&joekoe_cms.code_html(n_topic,1,0)&"'>"&joekoe_cms.code_html(n_topic,1,c_num)&"</a></td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"</table>"
if i=5 then
response.write "<table><tr><td colspan=""2"" height=""10""></td></tr></table>"
end if
rs.movenext
loop
i=0
do while not rs.eof
i=i+1
n_topic=rs("name")
pic=rs("pic")
n_topic=joekoe_cms.code_js(n_topic,1)
response.write "<table><tr>" & _
vbcrlf&"<td align=right class=tims>"&"<img src='"&rs("pic")&"'width='120' border='0'>""</td>" &_
vbcrlf&"</tr><tr>"&_
vbcrlf&"<td ><a href='javascript:;' onclick=javascript:open_view('music_disk_view.asp?id="&rs("id")&"',1); alt='浏览专辑:"&joekoe_cms.code_html(n_topic,1,0)&"'>"&joekoe_cms.code_html(n_topic,1,c_num)&"</a></td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"</table>"
if i=5 then
response.write "<table><tr><td colspan=""2"" height=""10""></td></tr></table>"
end if
rs.movenext
loop
展开全部
<%
sub disk_top(n_num,c_num)
response.write vbcrlf&music_bar_top("left_disk_good",0)
n_name="专辑"
sql="select top 10 name,pic,hits,id from music_disk where hidden=1 order by id desc"
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then
i=1
do while not rs.eof
n_topic=rs("name")
pic=rs("pic")
n_topic=joekoe_cms.code_js(n_topic,1)
response.write"<table width="72" border="0" align="center"><tr>"
while not rs_PUB.eof
response.write "<td><table><tr>" & _
vbcrlf&"<td align=right class=tims>"&"<img src='"&rs("pic")&"'width='120' border='0'>""</td>" &_
vbcrlf&"</tr><tr>"&_
vbcrlf&"<td ><a href='javascript:;' onclick=javascript:open_view('music_disk_view.asp?id="&rs("id")&"',1); alt='浏览专辑:"&joekoe_cms.code_html(n_topic,1,0)&"'>"&joekoe_cms.code_html(n_topic,1,c_num)&"</a></td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"</table></td>"
if i mod 5= 0 then
response.Write "</tr><tr>"
end if
rs.movenext
loop
response.write"</tr></table>"
rs.close
response.write vbcrlf&music_bar_end()
end sub
%>
sub disk_top(n_num,c_num)
response.write vbcrlf&music_bar_top("left_disk_good",0)
n_name="专辑"
sql="select top 10 name,pic,hits,id from music_disk where hidden=1 order by id desc"
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then
i=1
do while not rs.eof
n_topic=rs("name")
pic=rs("pic")
n_topic=joekoe_cms.code_js(n_topic,1)
response.write"<table width="72" border="0" align="center"><tr>"
while not rs_PUB.eof
response.write "<td><table><tr>" & _
vbcrlf&"<td align=right class=tims>"&"<img src='"&rs("pic")&"'width='120' border='0'>""</td>" &_
vbcrlf&"</tr><tr>"&_
vbcrlf&"<td ><a href='javascript:;' onclick=javascript:open_view('music_disk_view.asp?id="&rs("id")&"',1); alt='浏览专辑:"&joekoe_cms.code_html(n_topic,1,0)&"'>"&joekoe_cms.code_html(n_topic,1,c_num)&"</a></td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"</table></td>"
if i mod 5= 0 then
response.Write "</tr><tr>"
end if
rs.movenext
loop
response.write"</tr></table>"
rs.close
response.write vbcrlf&music_bar_end()
end sub
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询