以下ASP网站新闻如何分两列显示
想让这新闻的代码两列显示如何设置呀,请高手指导代码如下:<divalign="center"><tableborder="0"cellpadding="0"cellspa...
想让这新闻的代码两列显示如何设置呀,请高手指导
代码如下:
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="9"></td>
</tr>
<%
set rs = Server.CreateObject("ADODB.RecordSet"):rs.cursorlocation=3
rs.Open "select top 8 id,title,lm1,lm2,lm3,addtime from [WEBXX] where ( lm1=146 or lm2=146 or lm3=146 ) order by id desc",conn,1,1
while not rs.eof
title=jf(rs("title"))
%>
<tr>
<td height="24" > <a href='webview.asp?webxxid=<%=rs("id")%>' title='<%=title%>' style='color:444444'><%=titleb(title,20)%></a>
<%
if datediff("d",rs("addtime"),now())<=5 then
Response.Write "<img border=0 align='absmiddle' src='IMG/New.gif'>"
end if
%>
</td>
</tr>
<%
rs.movenext:wend
rs.close:set rs=nothing
%>
<tr>
<td height="1"></td>
</tr>
</table>
</div> 展开
代码如下:
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="9"></td>
</tr>
<%
set rs = Server.CreateObject("ADODB.RecordSet"):rs.cursorlocation=3
rs.Open "select top 8 id,title,lm1,lm2,lm3,addtime from [WEBXX] where ( lm1=146 or lm2=146 or lm3=146 ) order by id desc",conn,1,1
while not rs.eof
title=jf(rs("title"))
%>
<tr>
<td height="24" > <a href='webview.asp?webxxid=<%=rs("id")%>' title='<%=title%>' style='color:444444'><%=titleb(title,20)%></a>
<%
if datediff("d",rs("addtime"),now())<=5 then
Response.Write "<img border=0 align='absmiddle' src='IMG/New.gif'>"
end if
%>
</td>
</tr>
<%
rs.movenext:wend
rs.close:set rs=nothing
%>
<tr>
<td height="1"></td>
</tr>
</table>
</div> 展开
展开全部
定义一个变量I,根据查询显示递增1,然后做一个判断,就可以了,代码如下:
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="9"></td>
</tr>
<tr>
<td height="24" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
set rs = Server.CreateObject("ADODB.RecordSet"):rs.cursorlocation=3
rs.Open "select top 8 id,title,lm1,lm2,lm3,addtime from [WEBXX] where ( lm1=146 or lm2=146 or lm3=146 ) order by id desc",conn,1,1
i=0
while not rs.eof
title=jf(rs("title"))
%>
<td><a href='webview.asp?webxxid=<%=rs("id")%>' title='<%=title%>' style='color:444444'><%=titleb(title,20)%></a><%
if datediff("d",rs("addtime"),now())<=5 then
Response.Write "<img border=0 align='absmiddle' src='IMG/New.gif'>"
end if
%></td>
<%
i=i+1
if i mod 2 = 0 then response.Write "</tr><tr>"
rs.movenext:wend
rs.close:set rs=nothing
%>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1"></td>
</tr>
</table>
</div>
还有什么问题可以HI我!
http://www.idclend.com/
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="9"></td>
</tr>
<tr>
<td height="24" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
set rs = Server.CreateObject("ADODB.RecordSet"):rs.cursorlocation=3
rs.Open "select top 8 id,title,lm1,lm2,lm3,addtime from [WEBXX] where ( lm1=146 or lm2=146 or lm3=146 ) order by id desc",conn,1,1
i=0
while not rs.eof
title=jf(rs("title"))
%>
<td><a href='webview.asp?webxxid=<%=rs("id")%>' title='<%=title%>' style='color:444444'><%=titleb(title,20)%></a><%
if datediff("d",rs("addtime"),now())<=5 then
Response.Write "<img border=0 align='absmiddle' src='IMG/New.gif'>"
end if
%></td>
<%
i=i+1
if i mod 2 = 0 then response.Write "</tr><tr>"
rs.movenext:wend
rs.close:set rs=nothing
%>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1"></td>
</tr>
</table>
</div>
还有什么问题可以HI我!
http://www.idclend.com/
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询