关于asp代码(最近更新显示“new”)求助!
来源:百度知道 编辑:UC知道 时间:2024/06/15 02:25:55
我是一个asp菜鸟,正在学习中,遇到个难题,希望高手给予指点!
网站新闻页面部分代码:
<a href="shownews.asp?id=<%= RS("id") %>" target="_blank"><%= RS("TITLE") %></a> <font color="#999999">[<%= RS("infotime") %>] (阅读<font color="#ff0000"><%= RS("hits") %></font>次) <%if rs("infotime")=date() then%> <strong><font color="#FF0000" face="Arial">New</font></strong> <%end if%></font>
网站首页获取新闻部分代码:
<a href="shownews.asp?id=<%=rs_news("id")%>" target="_blank">
<%=cutstr(rs_news("title"),15)%></a> <%if rs("infotime")=date() then%> <strong><font color="#FF0000" face="Arial">New</font></strong> <%end if%><br>
网站新闻页面部分代码:
<a href="shownews.asp?id=<%= RS("id") %>" target="_blank"><%= RS("TITLE") %></a> <font color="#999999">[<%= RS("infotime") %>] (阅读<font color="#ff0000"><%= RS("hits") %></font>次) <%if rs("infotime")=date() then%> <strong><font color="#FF0000" face="Arial">New</font></strong> <%end if%></font>
网站首页获取新闻部分代码:
<a href="shownews.asp?id=<%=rs_news("id")%>" target="_blank">
<%=cutstr(rs_news("title"),15)%></a> <%if rs("infotime")=date() then%> <strong><font color="#FF0000" face="Arial">New</font></strong> <%end if%><br>
<%=cutstr(rs_news("title"),15)%></a> <%if rs("infotime")=date() then%>
--------------------------------------------------
这俩记录集名字不一样
改
--------------------->
<%=cutstr(rs_news("title"),15)%></a> <%if rs_news("infotime")=date() then%>
这样的疏忽也有啊首页里rs("infotime")是从哪来的
看得我都有点晕了。
个人觉得你应该从查询开始分析
对于最新的新闻就完全可以用select top 10 * from 新闻表 order by infotime desc来查询啊。功能是将最新上传的10条新闻显示啊
希望对你有所帮助
<%
Dim showDay
showDay = 3 '定义显示天数
if date - rs("infotime") > showDay then
response.write "new!"
end if
%>