asp中,怎么让新闻每行显示两条

来源:百度知道 编辑:UC知道 时间:2024/05/03 08:39:08
目前是这样的:
<table width="93%" border="0" cellspacing="0" cellpadding="0">
<%
set rs = server.createobject("adodb.recordset")
sql="SELECT top 8 * FROM gonggao where lei='2' order by id desc"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write "暂无新闻"
else
do while not rs.eof%>
<tr>
<td height="29"> · <a href="news_view.asp?id=<%=rs("id")%>" title="<%=rs("gonggao_tit")%>">
<%if len(rs("gonggao_tit"))>13 then%>
<%=left(rs("gonggao_tit"),13)%>...
<%else%>
<%=rs("gonggao_tit")%>
<%e

'楼主把如下代码贴在需要显示的位置(每行显示两条)
<table border=0 align=center width=90%>
<tr>
<%
set rs = server.createobject("adodb.recordset")
sql="SELECT top 8 * FROM gonggao where lei='2' order by id desc"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write "暂无新闻"
else
i=1
do while not rs.eof and i>0
%>
<td height=20 align=center><a href="news_view.asp?id=<%=rs("id")%>" title="<%=rs("gonggao_tit")%>">
<%if len(rs("gonggao_tit"))>13 then
response.write left(rs("gonggao_tit"),13)&"..."
else
response.write rs("gonggao_tit")
end if
%>
</a></td>
<%
i=i+1
rs.movenext
if i mod 2=1 then
response.write"</tr><tr>"
end if
loop
%>
<