求助:asp 每次刷新网站时随机显示28条新闻【哪位师傅帮忙!!!】 90
本人要改个商贸通的页面,每行显示两条新闻,想要实现个功能,每次刷新时随机显示28条新闻,代码如下<tablewidth="100%"border="0"cellspaci...
本人要改个商贸通的页面,每行显示两条新闻,想要实现个功能,每次刷新时随机显示28条新闻,代码如下
<table width="100%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr><td height=10></td></tr>
<tr>
<%set rs=server.createobject("adodb.recordset")
sql="select top 28 * from SMT_yp where SMT_vip=2 and SMT_key<>0 and SMT_key<>2 and SMT_key1=1 and del=0 order by SMT_id desc"
rs.open sql,conn,1,1
n=0
nn=rs.recordcount
do while not rs.eof
n=n+1
%>
<td width=50% height="22"> <a href=http://www.hljbz.cn/co.jsp?id=<%=rs("SMT_id")%>><font class=f14><%=rs("SMT_coname")%></font></a></td>
<%if n mod 2<>0 then response.write("<td width=10></td>")
if n mod 2=0 and nn<>n then response.write("</tr><tr>")
rs.movenext
loop
rs.close%>
</tr>
</table>
大家帮帮忙啊,着急啊 展开
<table width="100%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr><td height=10></td></tr>
<tr>
<%set rs=server.createobject("adodb.recordset")
sql="select top 28 * from SMT_yp where SMT_vip=2 and SMT_key<>0 and SMT_key<>2 and SMT_key1=1 and del=0 order by SMT_id desc"
rs.open sql,conn,1,1
n=0
nn=rs.recordcount
do while not rs.eof
n=n+1
%>
<td width=50% height="22"> <a href=http://www.hljbz.cn/co.jsp?id=<%=rs("SMT_id")%>><font class=f14><%=rs("SMT_coname")%></font></a></td>
<%if n mod 2<>0 then response.write("<td width=10></td>")
if n mod 2=0 and nn<>n then response.write("</tr><tr>")
rs.movenext
loop
rs.close%>
</tr>
</table>
大家帮帮忙啊,着急啊 展开
1个回答
展开全部
<table width="100%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr><td height=10></td></tr>
<tr>
<%set rs=server.createobject("adodb.recordset")
sql="select top 28 * from SMT_yp where SMT_vip=2 and SMT_key<>0 and SMT_key<>2 and SMT_key1=1 and del=0 order by NewID() Asc,SMT_id desc"
rs.open sql,conn,1,1
n=0
nn=rs.recordcount
do while not rs.eof
n=n+1
%>
<td width=50% height="22"> <a href=http://www.hljbz.cn/co.jsp?id=<%=rs("SMT_id")%>><font class=f14><%=rs("SMT_coname")%></font></a></td>
<%if n mod 2<>0 then response.write("<td width=10></td>")
if n mod 2=0 and nn<>n then response.write("</tr><tr>")
rs.movenext
loop
rs.close%>
</tr>
</table>
<tr><td height=10></td></tr>
<tr>
<%set rs=server.createobject("adodb.recordset")
sql="select top 28 * from SMT_yp where SMT_vip=2 and SMT_key<>0 and SMT_key<>2 and SMT_key1=1 and del=0 order by NewID() Asc,SMT_id desc"
rs.open sql,conn,1,1
n=0
nn=rs.recordcount
do while not rs.eof
n=n+1
%>
<td width=50% height="22"> <a href=http://www.hljbz.cn/co.jsp?id=<%=rs("SMT_id")%>><font class=f14><%=rs("SMT_coname")%></font></a></td>
<%if n mod 2<>0 then response.write("<td width=10></td>")
if n mod 2=0 and nn<>n then response.write("</tr><tr>")
rs.movenext
loop
rs.close%>
</tr>
</table>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询