日期:2014-05-16  浏览次数:21098 次

if判断问题,如何根据新文章发表的时间在该文章所在分类后加上一个标志
部分代码如下
sub mynews(a,b)
        response.Write("<table width=96% border=0 cellspacing=0 cellpadding=0>")
set rs=server.CreateObject("adodb.recordset")
sql="select top 7 ntype,max(fromid),max(id),max(norder),max(nEdittime) from yalist where yaType=2 and fromid="&a&" group by ntype  order by max(norder) desc, max(id) desc"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
        response.Write("<tr>")
        response.Write("<td class=3h><img src=images/5ice.gif width=5 height=5 hspace=5>")
set rst=conn.execute("select * from yaType where yaType=2 and id="&rs("nType")&"")
if not rst.eof then
response.write("<font color=#006600>【<a target=_blank href=article.asp?ntype="&rst("fromid")&"&fromid="&rst("ntype")&" >"&rst("typename")&"</a>】</font>")
end if
rst.close

set rst=nothing
显示效果是
【分类1】
【分类2】
...最多共9个分类的名字和超链接

 现在想实现如果 【分类1】中有新文章发布,后面调用一个图片标志一下,如无新文章,则不现实标志图片,即
【分类1】标志图片                      
【分类2】

 ...
 我的实现思路是:
 if now()-rs("max(nEditTime)")<=2 then
 response.Write("<img src=images/标志图片.gif width=28 height=11>") 
end if

如何添加 或者如何修改?以这个为思想改过几次,版面全部乱了

------解决方案--------------------
 if dateDiff("d",now(),rs("nEditTime"))<=2 then
  response.Write("<img src=images/标志图片.gif width=28 height=11>") 
 end if
------解决方案--------------------
你说什么什么?问都讲不明白,还加来加去。#2的方法是可以的。你以前的IF在哪,你就把他的加到哪个位置。

如果很多地方要输出图片标志,

你只需要写一个记录集。

再调用的页包含此记录集的页,再调用这个东西。

是如果这样的话,我就给你个例子。不然我也白讲了。
------解决方案--------------------
思路:把新文章写到一个单独的表中去