如何横向显示

photojing 2003-10-30 08:41:16
一般在网页显示用asp调用数据库的结果都是竖排的,就是显示一项就另起一行再显示,那如何让他横着显示,甚至横着只显示两项内容然后就提行再显示两项(以后的都这么排下来)呢
...全文
33 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
pzlk 2003-10-30
  • 打赏
  • 举报
回复
i=1
......
rs.movenext
i=i+1
if i mod 2 then
response.write "<br>"
...
say1no2 2003-10-30
  • 打赏
  • 举报
回复
<%do while not rs.eof%>
<tr>
<td><%=rs(0)%></td>
<td>
<%
rs.movenext
if not rs.eof then
%>
<%=rs(0)%>
<%
rs.movenext
end if
%>
</td>
</tr>
<%
loop
%>
bevin1010 2003-10-30
  • 打赏
  • 举报
回复
你不是要一行显示两条记录吗?上面已经很清楚了!用两次rs.movenext!
photojing 2003-10-30
  • 打赏
  • 举报
回复
没看懂,能给个说明吗?
bevin1010 2003-10-30
  • 打赏
  • 举报
回复
<% set rs=server.CreateObject("Adodb.recordset")
sql="select top 10 newsid,topic from news where audit=1 order by ntime desc"
rs.open sql,conn,1,1
dim i
i=1
if rs.eof and rs.bof then
response.write"没有任何相关新闻!"
else
%>
<table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
<%do while rs.eof<>true and i<6%>
<tr>
<td width="30" height="22" align="center"><img src="images/039.jpg" width="4" height="8"></td>
<td width="260">
<%topic=rs("topic")
if len(trim(topic))>17 then
topic=left(topic,17)&"..."
end if
response.write "<a href=news/shownews.asp?newsid="&rs("newsid")&" target=_blank>"&topic&"</a>"
%>
</td>
<% rs.movenext
if rs.eof then
exit do
end if
%>
<td width="30" align="center"><img src="images/039.jpg" width="4" height="8"></td>
<td><% if rs.eof<>true then
topic=rs("topic")
if len(trim(topic))>15 then
topic=left(topic,15)&"..."
end if
response.write "<a href=news/shownews.asp?newsid="&rs("newsid")&" target=_blank>"&topic&"</a>"
end if
%>
</td>
</tr>
<%
rs.movenext
i=i+1
loop
%>
</table>
<% end if
rs.close
set rs=nothing
%>
photojing 2003-10-30
  • 打赏
  • 举报
回复
??自己顶

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧