标题:向各位高手求教:如何才能在下面代码中显示当天新加的新闻标题后头显示NEW图 ...
只看楼主
flash4
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-4-27
 问题点数:0 回复次数:1 
向各位高手求教:如何才能在下面代码中显示当天新加的新闻标题后头显示NEW图标
代码如下:
我是搞了好久没做出来,请各位给我加一下代码。谢谢!!!
javastr=""
javastr=javastr+"<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"
<!--#include file="conn.asp"-->
<%
owen=request("owen")
owen1=request("owen1")
owen2=request("owen2")
n=request("n")
if n="" then
n=100
end if%>

<%
if owen1<>"" and owen2<>"" then
sql="select  * from NEWS where BigClassName='"& owen1 &"' and  SmallClassName='"& owen2 &"' order by id desc"
set rs=conn.execute(sql)
do while not rs.eof
%>
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 0px dotted\">"
javastr=javastr+"■&nbsp;<span style=\"font-size:9pt;line-height:0pt\"><% if rs("imagenum")<>"0" then response.write "<img src='images/news.gif' border=0 alt='图片新闻'>" end if %><a href=\"onews.asp?id=<%=rs("id")%>\" title=\"<%=rs("title")%>\" target=\"_blank\"><%=left(rs("title"),20)%></a></span> <font color=\"#999999\" >[<%=rs("infotime")%>]</font> <font color=\"#999999\" >(阅读<font color=\"#FF0000\" ><%=rs("hits")%></font>次)</font>"
javastr=javastr+"</td></tr>"
<%n=n-1
if n<1 then exit do
rs.movenext
loop
%>
javastr=javastr+"</table>"
<%
rs.close   
set rs=nothing   
%>
document.write (javastr)

<%
ElseIf owen2<> "" then
sql="select  * from NEWS where SmallClassName='"& owen2 &"' order by id desc"
set rs=conn.execute(sql)
do while not rs.eof
%>
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 0px dotted\">"
javastr=javastr+"■&nbsp;<span style=\&quot;font-size:9pt;line-height:0pt\"><% if rs("imagenum")<>"0" then response.write "<img src='images/news.gif' border=0 alt='图片新闻'>" end if %><a href=\"onews.asp?id=<%=rs("id")%>\" title=\"<%=rs("title")%>\" target=\"_blank\"><%=left(rs("title"),20)%></a></span> <font color=\"#999999\" >[<%=rs("infotime")%>]</font> <font color=\"#999999\" >(阅读<font color=\"#FF0000\" ><%=rs("hits")%></font>次)</font>"
javastr=javastr+"</td></tr>"
<%n=n-1
if n<1 then exit do
rs.movenext
loop
%>
javastr=javastr+"</table>"
<%
rs.close   
set rs=nothing   
%>
document.write (javastr)

<%
ElseIf  owen1<>"" then
sql="select  * from NEWS where BigClassName='"& owen1 &"' order by id desc"
set rs=conn.execute(sql)
do while not rs.eof
%>
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 0px dotted\">"
javastr=javastr+"■&nbsp;<span style=\&quot;font-size:9pt;line-height:0pt\"><% if rs("imagenum")<>"0" then response.write "<img src='images/news.gif' border=0 alt='图片新闻'>" end if %><a href=\"onews.asp?id=<%=rs("id")%>\" title=\"<%=rs("title")%>\" target=\"_blank\"><%=rs("title")%></a></span> <font color=\"#999999\" >[<%=rs("infotime")%>]</font> <font color=\"#999999\" >(阅读<font color=\"#FF0000\" ><%=rs("hits")%></font>次)</font>"
javastr=javastr+"</td></tr>"
<%n=n-1
if n<1 then exit do
rs.movenext
loop
%>
javastr=javastr+"</table>"
<%
rs.close   
set rs=nothing   
%>
document.write (javastr)
<% End If %>

<%
if owen1= "" and owen2= "" then
sql="select * from NEWS order by id desc"
set rs=conn.execute(sql)
do while not rs.eof
%>
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 0px dotted\">"
javastr=javastr+"■&nbsp;<span style=\&quot;font-size:9pt;line-height:0pt\"><% if rs("imagenum")<>"0" then response.write "<img src='images/news.gif' border=0 alt='图片新闻'>" end if %><a href=\"onews.asp?id=<%=rs("id")%>\" title=\"<%=rs("title")%>\" target=\"_blank\"><%=left(rs("title"),20)%></a></span> <font color=\"#999999\" >[<%=rs("infotime")%>]</font> <font color=\"#999999\" >(阅读<font color=\"#FF0000\" ><%=rs("hits")%></font>次)</font>"
javastr=javastr+"</td></tr>"
<%n=n-1
if n<1 then exit do
rs.movenext
loop
%>
javastr=javastr+"</table>"
<%rs.close   
set rs=nothing   
conn.close   
set conn=nothing%>
document.write (javastr)
<%end if%>
搜索更多相关主题的帖子: NEW 图标 request 
2008-04-27 18:46
hxfly
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:5807
专家分:108
注 册:2005-4-7
得分:0 
if 添加日期=today then
输出 NEW图片+后面的
else
输出后面的
end if

2008-04-28 00:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-211346-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.225578 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved