<!--#include file="conn.asp"-->
<!--#include file="inc/format.asp"-->
<%start="最新动态"%>
<!--#include file="inc/inc.asp"-->
<%
dim founderr,errmsg
founderr=false
errmsg=""
if request("page")<>"" then
  if not isInteger(request("page")) then
    founderr=true
    errmsg=errmsg+"<br>"+"<li>非法的新闻分页参数。"
  end if
end if
if request("type")<>"" then
  if not isInteger(request("type")) then
    founderr=true
    errmsg=errmsg+"<br>"+"<li>非法的新闻显示参数。"
  end if
end if

if founderr then
response.write "<script>err('"&errmsg&"')</script>"
response.end
end if

dim totalnews,Currentpage,totalpages,i
sql="select news_id,news_title,news_date from news order by news_date DESC"
if request("type")=2 then
sql="select news_id,news_title,news_date from news order by news_date DESC"
elseif request("type")=3 then
sql="select news_id,news_title,news_date from news order by news_date ASC"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1

response.write vbcrlf & "<script language=""javascript"">" & vbcrlf
response.write "function title_menu(){" & vbcrlf
response.write "document.write("""

response.write "<img src=images/link2.gif border='0'>&nbsp;<a href='news.asp'>所有新闻</a>&nbsp;<img src=images/link2.gif border='0'>&nbsp;<a href='?type=1'>最新十篇新闻</a>&nbsp;<img src=images/link2.gif border='0'>&nbsp;<a href='?type=2'>按时间降序排列</a>&nbsp;<img src=images/link2.gif border='0'>&nbsp;<a href='?type=3'>按时间升序排列</a>"");}"

response.write "function table_title(){" & vbcrlf

response.write "document.write(""<img src=images/biao.gif align=absmiddle>&nbsp;"
if request("type")=1 then
response.write "最新的10篇新闻"
else
response.write "共有<span class=newshead>"&rs.recordcount&"</span>篇新闻"
end if
response.write """);" & vbcrlf
response.write "}" & vbcrlf


response.write "function table_main(){" & vbcrlf
response.write "document.write(""<table cellSpacing=0 cellPadding=6 border=1 style='border-collapse: collapse' bordercolor="&border&" class=a3><tr class=td1><td align=center height=22>新闻列表</td><td width=27% align=center>更新时间</td></tr>"
if not rs.eof then
rs.movefirst
rs.pagesize=newsperpage
if trim(request("page"))<>"" then
   currentpage=clng(request("page"))
   if currentpage>rs.pagecount then
      currentpage=rs.pagecount
   end if
else
   currentpage=1
end if
   totalnews=rs.recordcount
   if currentpage<>1 then
       if (currentpage-1)*newsperpage<totalnews then
	       rs.move(currentpage-1)*newsperpage
		   dim bookmark
		   bookmark=rs.bookmark
	   end if
   end if
   if (totalnews mod newsperpage)=0 then
      totalpages=totalnews\newsperpage
   else
      totalpages=totalnews\newsperpage+1
   end if
i=0
do while not rs.eof and i<newsperpage

response.write "<tr><td height=22>&nbsp;<img src=images/i1.gif border=0>&nbsp;<a href=shownews.asp?news_id="&rs("news_id")&" target=_blank>"&FormatStr(rs("news_title"))&"</a></td><td align=center>"&rs("news_date")&"</td></tr>"
i=i+1
rs.movenext
loop
else
if rs.eof and rs.bof then
response.write "<tr><td colspan=2 height=22 align=center>当前没有新闻！</td></tr>"
end if
end if
response.write "</table>"
if not request("type")=1 then
response.write "<Br><table cellspacing=0 cellpadding=0 width=100% align=center border=0 class=a3><form name=form1 method=post action=news.asp><tr class=td1><td align=middle width=35% height=25><img height=14 src=images/cha.gif width=14 align=absMiddle> 共[<font color=#FF6666>"&totalnews&"</font>]个作品　分[<font color=#FF6666>"&totalpages&"</font>]页</td><td width=40% align=middle><img height=11 src=images/lt.gif width=11 align=absMiddle>&nbsp"
if CurrentPage<2 then
response.write "<font color='999966'>首页 上一页</font>"
else
response.write "<a href=news.asp?page=1>首页</a>"
response.write "<a href=news.asp?page="&CurrentPage-1&">上一页</a>"
end if
if totalpages-currentpage<1 then
response.write "<font color='999966'>下一页 尾页</font>"
else
response.write "<a href=news.asp?page="&(CurrentPage+1)&""
response.write ">下一页</a> <a href=news.asp?page="&totalpages&">尾页</a>"
end if
response.write "&nbsp<img height=11 src=images/gt.gif width=11 align=absMiddle></td><form name=form1 method=post action=news.asp><td width=25% align=middle><select name=page class=lanyu>"

i=1
for i=1 to totalpages
if i=currentpage then
response.write "<option value="&i&" selected>第"&i&"页</option>"
else
response.write "<option value="&i&">第"&i&"页</option>"
end if
next
response.write "</select><input type=submit name=Submit2 value=转向 class=button></td></form></tr></table><br>"
end if
response.write """);}" & vbcrlf

response.write "function table_left(){" & vbcrlf
response.write "document.write("""
call left_t_1("<table align=center height=22><tr><td><b>本 站 声 明</b></td></tr></table>本站的大部分资料，文章都来自网上收集，其版权归作者本人所有，如果有任何侵犯您权益的地方，请联系我们，我们将马上进行整理，谢谢。")
response.write """);}" & vbcrlf

response.write "</script>"
%>
<SCRIPT>top()</SCRIPT>
<script>title()</script>
<script>vtop()</script>

<Script>table()</Script>

<Script>vbottom()</Script>

<script>vtop()</script>
<script>table1("","<p align=center>"+add+"<br><br><font color=#ff0000>"+cou+"</font>")</script>
<Script>bottom()</Script>

