📄 allnews.asp
字号:
<!--#include file="include/dbopenbd.asp" -->
<%
action=trim(request("class"))
Set rs = conn.Execute("select * from s_config")
title=rs("newstitle"&action)
if title="" then response.redirect "news_home.asp"
set rs=nothing
pages=30
%>
<HTML>
<HEAD>
<TITLE>新闻中心 - <%=title%></TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="description" content="<%=sitedescription%>">
<meta name="keywords" content="<%=sitekeywords%>">
<link rel="stylesheet" href="include/css.css" type="text/css">
</HEAD>
<center>
<!--#include file="a_top.asp"-->
<table width="760" border=0 cellspacing=0 cellpadding=0 align=center bgcolor="#FFFFFF" class="grayline">
<tr><td bgcolor="FFFBF7" align=center valign=top width=185>
<!--#include file="a_login.asp" -->
<!--#include file="a_tree.asp" -->
</td>
<td bgcolor="#CCCCCC" width="1"></td>
<td width=569 align=center valign=top>
<table cellspacing=0 cellpadding=0 width=566 bgcolor=#FFFFFF border=0 class="new" align="center">
<tbody><tr><td height=30>目前位置:<a href=main.asp>首页</a> > <a href="news_home.asp">新闻中心</a> > <%=title%></td></tr>
<tr><td height="1" background="images/small/bgline.gif"></td></tr>
<tr><td> </td></tr>
<tr><td width=98% valign=top>
<table border=0 width=165>
<tr><td width=165 height=28 background=images/small/newsbar.gif align=center><%=title%></td></tr>
</table>
<table cellpadding=2 cellspacing=0 border=0 width=95% align=center bgcolor=#FFFFFF>
<%
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from s_news where online='1' and (getdate()<OffDate or OffDate is null) and getdate()>=PubDate and NewsClass='"&action&"' order by uup desc,Pubdate desc"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.write "<tr><td height=50 align=center>暂时没有新闻文章</td></tr>"
else
rs.pageSize = pages '每页记录数
allPages = rs.pageCount '总页数
page = Request("page") '从浏览器取得当前页
'if是基本的出错处理
If not isNumeric(page) then page=1
if isEmpty(page) or clng(page) < 1 then
page = 1
elseif clng(page) >= allPages then
page = allPages
end if
rs.AbsolutePage = page '转到某页头部
do while not rs.eof and pages>0
%>
<tr><td width=55%>
<a href="news.asp?NewsId=<%=rs("NewsId")%>"><%=lleft(rs("NewsTitle"),40)%></a></td>
<td width=25%><%=rs("PubDate")%></td><td width=20%>人气值:<%=rs("cktimes")%></td></tr>
<%
pages = pages - 1
rs.movenext
loop
end if
%>
</table>
</td></tr>
<%
call listpage()
%>
</table>
</td></tr>
</table>
<!--#include file="a_bottom.asp"-->
</BODY></CENTER>
</HTML>
<%
sub listpage()
'if allpages<=1 then exit sub
response.write "<tr><td height=30> </td></tr><tr><td colspan=3 height=1 background=images/small/bgline.gif></td></tr>"
response.write "<tr><td align=center>"
response.write "<br>总计 "&rs.RecordCount&" 篇文章 "
if page = 1 then
response.write "<font color=darkgray>首页 前页</font>"
else
response.write "<a href=allnews.asp?class="&action&"&page=1>首页</a> <a href=allnews.asp?class="&action&"&page="&page-1&">前页</a>"
end if
if page = allpages then
response.write "<font color=darkgray> 下页 末页</font>"
else
response.write " <a href=allnews.asp?class="&action&"&page="&page+1&">下页</a> <a href=allnews.asp?class="&action&"&page="&allpages&">末页</a>"
end if
response.write " 第"&page&"页 共"&allpages&"页 </td></tr>"
end sub
set rs=nothing
conn.close
set conn=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -