<%
'用于制作在页面(首页或其他页面)中显示新闻标题的长度,在下面要显示的标题中调用函数即可.
conn_open()
function cutstr(tempstr,tempwid)
if len(tempstr)>tempwid then
cutstr=left(tempstr,tempwid)&"..."
else
cutstr=tempstr
end if
end function
%>
<%
set rs=server.createobject("adodb.recordset")
exec="select top 6 * from news_info where Nc_id=5 order by ni_id desc"
rs.open exec,conn,1,1
do while not rs.eof
%>
" target="_blank" class="a1"> <%=cutstr(rs("Ni_title_s"),25)%>
<%
'条件语句,用于判断,如果时间等于当天,就显示news.gif这个图片.如果用"if datediff("d",formatdatetime(rs("ni_addtime_d")),now)<=cint(daynum) then"替换"if rs("Ni_addtime_d")=date() then",将daynum改为1.2.3等,就可使图片显示不只一天.
if datediff("d",formatdatetime(rs("ni_addtime_d")),now)<=cint(10) then
response.write("")
end if
%>
[<%=rs("Ni_addtime_d")%>]