ASP种表格循环问题
以下是输出4条新闻的代码,请问,如果我想输出八条新闻,分为两列,即左边四条右边四条,请问循环该怎么写,谢谢!<!--#includefile="conn.asp"--><...
以下是输出4条新闻的代码,请问,如果我想输出八条新闻,分为两列,即左边四条右边四条,请问循环该怎么写,谢谢!
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select top 4 * from news order by news_id desc"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write("当前没有新闻")
else
%>
<table width="460" border="0" cellpadding="0" cellspacing="0">
<tr>
<%do until rs.eof %>
<td width="317" height="20"><a href="shownews.asp?id=<%=rs("news_id")%>" target="_blank"><%=rs("news_title")%></a></td>
<td width="81"><%=rs("time")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>
<%end if
rs.close
set rs=nothing
end sub
%> 展开
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select top 4 * from news order by news_id desc"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write("当前没有新闻")
else
%>
<table width="460" border="0" cellpadding="0" cellspacing="0">
<tr>
<%do until rs.eof %>
<td width="317" height="20"><a href="shownews.asp?id=<%=rs("news_id")%>" target="_blank"><%=rs("news_title")%></a></td>
<td width="81"><%=rs("time")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>
<%end if
rs.close
set rs=nothing
end sub
%> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询