ASP代码问题,需要在最新两天发布的信息后,加上一个小图标
说明:这是一段代码,其它文件调用了这段函数.现在我想在最新两天发布的信息标题后面,加上一个new的图标,请问怎么加?表名是info,时间表段是adddate.Functi...
说明:这是一段代码,其它文件调用了这段函数.
现在我想在最新两天发布的信息标题后面,加上一个new的图标,请问怎么加?
表名是info,时间表段是adddate.
Function zf11_ShowInfo(s_num,nums,Linenum,S_info,Show_date)
response.write "<table width=""100%"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"">"& vbCrLf
Select case s_num
case 1 '热门
InfoSql="select top "&nums&" * from Info order by hits desc,ID desc"
case 2 '新信息
InfoSql="select top "&nums&" * from Info order by AddDate desc,ID desc"
case 3 '大类热门
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by hits desc,ID desc"
case 4 '小类热门
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by hits desc,ID desc"
case 5 '大类
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by AddDate desc,ID desc"
case 6 '小类
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by AddDate desc,ID desc"
Case 7 '推荐
InfoSql="select top "&nums&" * from Info Where Pw_Good=True ORDER BY id DESC"
Case else '其它
InfoSql="select top "&nums&" * from Info order by hits desc"
End Select
Set InfoRs=Conn.Execute(InfoSql)
if InfoRs.eof or InfoRs.bof then
response.write"<tr><td align='center'>没有信息...</td></tr>"
end if
while not Infors.eof
set title=Infors("title")
set id=Infors("id")
response.write "<tr><td width=""4%""align=""center"" height=""25"" background=""images/table_bg2.gif""><img src=""Images/zf11_ico.gif"" width=""6"" height=""6"" align=""absmiddle""></td><td width=""62%"" height=""25"" background=""images/table_bg2.gif"" ><p style='line-height: 150%'>"& vbCrLf
response.write "<a href='typenews.asp?id="&id&"'title='"&title&"'>"
response.write "<font color='#333333' size=2>"
if GetLen(title)>26 then
response.write ""&LeftStr(title,24)&""
response.write ".."
else
response.write ""&title&""
end if
response.write "</a></td>"
response.write "</font>"
response.write "<td width=""30%""align=""left"" height=""25"" background=""images/table_bg2.gif"">"
if Show_date=1 then
response.write " "
response.write "<font color='#333333' size=2>"
response.write DateTimeFormat(Infors("AddDate"),3)
response.write "</font>"
End if
response.write "</a></td></tr>"
Infors.movenext
wend
Infors.close
set Infors=nothing
response.write "</table>"
End Function 展开
现在我想在最新两天发布的信息标题后面,加上一个new的图标,请问怎么加?
表名是info,时间表段是adddate.
Function zf11_ShowInfo(s_num,nums,Linenum,S_info,Show_date)
response.write "<table width=""100%"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"">"& vbCrLf
Select case s_num
case 1 '热门
InfoSql="select top "&nums&" * from Info order by hits desc,ID desc"
case 2 '新信息
InfoSql="select top "&nums&" * from Info order by AddDate desc,ID desc"
case 3 '大类热门
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by hits desc,ID desc"
case 4 '小类热门
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by hits desc,ID desc"
case 5 '大类
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by AddDate desc,ID desc"
case 6 '小类
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by AddDate desc,ID desc"
Case 7 '推荐
InfoSql="select top "&nums&" * from Info Where Pw_Good=True ORDER BY id DESC"
Case else '其它
InfoSql="select top "&nums&" * from Info order by hits desc"
End Select
Set InfoRs=Conn.Execute(InfoSql)
if InfoRs.eof or InfoRs.bof then
response.write"<tr><td align='center'>没有信息...</td></tr>"
end if
while not Infors.eof
set title=Infors("title")
set id=Infors("id")
response.write "<tr><td width=""4%""align=""center"" height=""25"" background=""images/table_bg2.gif""><img src=""Images/zf11_ico.gif"" width=""6"" height=""6"" align=""absmiddle""></td><td width=""62%"" height=""25"" background=""images/table_bg2.gif"" ><p style='line-height: 150%'>"& vbCrLf
response.write "<a href='typenews.asp?id="&id&"'title='"&title&"'>"
response.write "<font color='#333333' size=2>"
if GetLen(title)>26 then
response.write ""&LeftStr(title,24)&""
response.write ".."
else
response.write ""&title&""
end if
response.write "</a></td>"
response.write "</font>"
response.write "<td width=""30%""align=""left"" height=""25"" background=""images/table_bg2.gif"">"
if Show_date=1 then
response.write " "
response.write "<font color='#333333' size=2>"
response.write DateTimeFormat(Infors("AddDate"),3)
response.write "</font>"
End if
response.write "</a></td></tr>"
Infors.movenext
wend
Infors.close
set Infors=nothing
response.write "</table>"
End Function 展开
2个回答
展开全部
Function zf11_ShowInfo(s_num,nums,Linenum,S_info,Show_date)
response.write "<table width=""100%"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"">"& vbCrLf
Select case s_num
case 1 '热门
InfoSql="select top "&nums&" * from Info order by hits desc,ID desc"
case 2 '新信息
InfoSql="select top "&nums&" * from Info order by AddDate desc,ID desc"
case 3 '大类热门
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by hits desc,ID desc"
case 4 '小类热门
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by hits desc,ID desc"
case 5 '大类
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by AddDate desc,ID desc"
case 6 '小类
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by AddDate desc,ID desc"
Case 7 '推荐
InfoSql="select top "&nums&" * from Info Where Pw_Good=True ORDER BY id DESC"
Case else '其它
InfoSql="select top "&nums&" * from Info order by hits desc"
End Select
Set InfoRs=Conn.Execute(InfoSql)
if InfoRs.eof or InfoRs.bof then
response.write"<tr><td align='center'>没有信息...</td></tr>"
end if
while not Infors.eof
set title=Infors("title")
set id=Infors("id")
response.write "<tr><td width=""4%""align=""center"" height=""25"" background=""images/table_bg2.gif""><img src=""Images/zf11_ico.gif"" width=""6"" height=""6"" align=""absmiddle""></td><td width=""62%"" height=""25"" background=""images/table_bg2.gif"" ><p style='line-height: 150%'>"& vbCrLf
response.write "<a href='typenews.asp?id="&id&"'title='"&title&"'>"
response.write "<font color='#333333' size=2>"
if GetLen(title)>26 then
response.write ""&LeftStr(title,24)&""
response.write ".."
else
response.write ""&title&""
end if
response.write "</a>"
'=======
'关键是这里了======
if DateDiff("d",Infors("AddDate"),now())<=3 then
response.Write"<img src='images/new.gif' alt='最新发布'>"
end if
'=====================
response.write"</td>"
response.write "</font>"
response.write "<td width=""30%""align=""left"" height=""25"" background=""images/table_bg2.gif"">"
if Show_date=1 then
response.write " "
response.write "<font color='#333333' size=2>"
response.write DateTimeFormat(Infors("AddDate"),3)
response.write "</font>"
End if
response.write "</a></td></tr>"
Infors.movenext
wend
Infors.close
set Infors=nothing
response.write "</table>"
End Function
response.write "<table width=""100%"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"">"& vbCrLf
Select case s_num
case 1 '热门
InfoSql="select top "&nums&" * from Info order by hits desc,ID desc"
case 2 '新信息
InfoSql="select top "&nums&" * from Info order by AddDate desc,ID desc"
case 3 '大类热门
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by hits desc,ID desc"
case 4 '小类热门
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by hits desc,ID desc"
case 5 '大类
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by AddDate desc,ID desc"
case 6 '小类
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by AddDate desc,ID desc"
Case 7 '推荐
InfoSql="select top "&nums&" * from Info Where Pw_Good=True ORDER BY id DESC"
Case else '其它
InfoSql="select top "&nums&" * from Info order by hits desc"
End Select
Set InfoRs=Conn.Execute(InfoSql)
if InfoRs.eof or InfoRs.bof then
response.write"<tr><td align='center'>没有信息...</td></tr>"
end if
while not Infors.eof
set title=Infors("title")
set id=Infors("id")
response.write "<tr><td width=""4%""align=""center"" height=""25"" background=""images/table_bg2.gif""><img src=""Images/zf11_ico.gif"" width=""6"" height=""6"" align=""absmiddle""></td><td width=""62%"" height=""25"" background=""images/table_bg2.gif"" ><p style='line-height: 150%'>"& vbCrLf
response.write "<a href='typenews.asp?id="&id&"'title='"&title&"'>"
response.write "<font color='#333333' size=2>"
if GetLen(title)>26 then
response.write ""&LeftStr(title,24)&""
response.write ".."
else
response.write ""&title&""
end if
response.write "</a>"
'=======
'关键是这里了======
if DateDiff("d",Infors("AddDate"),now())<=3 then
response.Write"<img src='images/new.gif' alt='最新发布'>"
end if
'=====================
response.write"</td>"
response.write "</font>"
response.write "<td width=""30%""align=""left"" height=""25"" background=""images/table_bg2.gif"">"
if Show_date=1 then
response.write " "
response.write "<font color='#333333' size=2>"
response.write DateTimeFormat(Infors("AddDate"),3)
response.write "</font>"
End if
response.write "</a></td></tr>"
Infors.movenext
wend
Infors.close
set Infors=nothing
response.write "</table>"
End Function
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
网易云信
2023-12-06 广告
2023-12-06 广告
很高兴能回答您的问题。以下是一段针对“一对一消息组件”的描述,字数在200字左右:该组件支持用户之间的私密交流,让沟通更加直接和高效。通过它,您可以向特定对象发送消息,并实时查看消息状态,包括对方是否已读或未读。同时,该组件还支持富文本消息...
点击进入详情页
本回答由网易云信提供
展开全部
'我给你改的使用文字NEW,如果你要使用图片,替换成img标签就可以。
还有,要改动你截取标题的地方,不能是26了,要考虑多出来的图片或文字的长度。
--------------------------------------------------------------------
Function zf11_ShowInfo(s_num,nums,Linenum,S_info,Show_date)
response.write "<table width=""100%"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"">"& vbCrLf
Select case s_num
case 1 '热门
InfoSql="select top "&nums&" * from Info order by hits desc,ID desc"
case 2 '新信息
InfoSql="select top "&nums&" * from Info order by AddDate desc,ID desc"
case 3 '大类热门
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by hits desc,ID desc"
case 4 '小类热门
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by hits desc,ID desc"
case 5 '大类
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by AddDate desc,ID desc"
case 6 '小类
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by AddDate desc,ID desc"
Case 7 '推荐
InfoSql="select top "&nums&" * from Info Where Pw_Good=True ORDER BY id DESC"
Case else '其它
InfoSql="select top "&nums&" * from Info order by hits desc"
End Select
Set InfoRs=Conn.Execute(InfoSql)
if InfoRs.eof or InfoRs.bof then
response.write"<tr><td align='center'>没有信息...</td></tr>"
end if
while not Infors.eof
set title=Infors("title")
set id=Infors("id")
response.write "<tr><td width=""4%""align=""center"" height=""25"" background=""images/table_bg2.gif""><img src=""Images/zf11_ico.gif"" width=""6"" height=""6"" align=""absmiddle""></td><td width=""62%"" height=""25"" background=""images/table_bg2.gif"" ><p style='line-height: 150%'>"& vbCrLf
response.write "<a href='typenews.asp?id="&id&"'title='"&title&"'>"
response.write "<font color='#333333' size=2>"
if GetLen(title)>26 then
response.write ""&LeftStr(title,24)&""
response.write ".."
else
response.write ""&title&""
end if
if DateDiff("d",Date,Infors("AddDate"))<3 then
response.write "NEW</a></td>"
else
response.write "</a></td>"
end if
response.write "</font>"
response.write "<td width=""30%""align=""left"" height=""25"" background=""images/table_bg2.gif"">"
if Show_date=1 then
response.write " "
response.write "<font color='#333333' size=2>"
response.write DateTimeFormat(Infors("AddDate"),3)
response.write "</font>"
End if
response.write "</a></td></tr>"
Infors.movenext
wend
Infors.close
set Infors=nothing
response.write "</table>"
End Function
还有,要改动你截取标题的地方,不能是26了,要考虑多出来的图片或文字的长度。
--------------------------------------------------------------------
Function zf11_ShowInfo(s_num,nums,Linenum,S_info,Show_date)
response.write "<table width=""100%"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"">"& vbCrLf
Select case s_num
case 1 '热门
InfoSql="select top "&nums&" * from Info order by hits desc,ID desc"
case 2 '新信息
InfoSql="select top "&nums&" * from Info order by AddDate desc,ID desc"
case 3 '大类热门
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by hits desc,ID desc"
case 4 '小类热门
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by hits desc,ID desc"
case 5 '大类
InfoSql="select top "&nums&" * from Info where Sort1="&S_info&" order by AddDate desc,ID desc"
case 6 '小类
InfoSql="select top "&nums&" * from Info where Sort2="&S_info&" order by AddDate desc,ID desc"
Case 7 '推荐
InfoSql="select top "&nums&" * from Info Where Pw_Good=True ORDER BY id DESC"
Case else '其它
InfoSql="select top "&nums&" * from Info order by hits desc"
End Select
Set InfoRs=Conn.Execute(InfoSql)
if InfoRs.eof or InfoRs.bof then
response.write"<tr><td align='center'>没有信息...</td></tr>"
end if
while not Infors.eof
set title=Infors("title")
set id=Infors("id")
response.write "<tr><td width=""4%""align=""center"" height=""25"" background=""images/table_bg2.gif""><img src=""Images/zf11_ico.gif"" width=""6"" height=""6"" align=""absmiddle""></td><td width=""62%"" height=""25"" background=""images/table_bg2.gif"" ><p style='line-height: 150%'>"& vbCrLf
response.write "<a href='typenews.asp?id="&id&"'title='"&title&"'>"
response.write "<font color='#333333' size=2>"
if GetLen(title)>26 then
response.write ""&LeftStr(title,24)&""
response.write ".."
else
response.write ""&title&""
end if
if DateDiff("d",Date,Infors("AddDate"))<3 then
response.write "NEW</a></td>"
else
response.write "</a></td>"
end if
response.write "</font>"
response.write "<td width=""30%""align=""left"" height=""25"" background=""images/table_bg2.gif"">"
if Show_date=1 then
response.write " "
response.write "<font color='#333333' size=2>"
response.write DateTimeFormat(Infors("AddDate"),3)
response.write "</font>"
End if
response.write "</a></td></tr>"
Infors.movenext
wend
Infors.close
set Infors=nothing
response.write "</table>"
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询