ASP 一行显示两条新闻

<%
set rs = server.createobject("adodb.recordset")
sql="SELECT top 16 * FROM Qianbo_News  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=left>
<%
if i mod 2=0 then
  response.write"<img style="" border:0"" src=""images/sx-.jpg"" />"
end if
%>

<a href="NewsView.Asp?id=<%=rs("ID")%>" title="<%=rs("NewsName")%>">
<%if len(rs("NewsName"))>20 then
 response.write left(rs("NewsName"),20)&"..."
else
 response.write rs("NewsName")
end if
%>
</a></td>
<%
i=i+1
rs.movenext
if i mod 2=1 then
  response.write"<tr><td style=""background:url(Images/bg2.gif) repeat-x left bottom;""></td><td style=""background:url(Images/bg2.gif) repeat-x left bottom;""></td></tr>"
end if
loop
end if
%>

 

posted @ 2012-11-05 10:20  Liu66~  阅读(195)  评论(0编辑  收藏  举报