<!--#include file="pysjzx_conn.asp"-->
<!--#include file="webconfig.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=webname%>-新闻<%
       classid=trim(request("class"))
        if  classid="" then
        					  if IsNumeric(request.QueryString("classid"))=False then
        					  response.write("<script>alert(""非法访问!"");location.href=""news.asp"";</script>")
end if
    sqlnews="select * from News  order by adddate desc"
    else
               sqlnews="select * from News where class="&classid&" order by adddate desc"
       
					set rs2=server.createobject("adodb.recordset")
		rs2.Open "select * from newsclass where id="&classid&"",conn,1,1
         response.write "-"&rs2("class")
         newsclass=rs2("class")
         rs2.close
         set rs2=nothing
    end if

		%></title>
<meta content="<%=keyword%>" name="keywords">
<meta content="<%=description%>" name="description">
<LINK href="css/style.css" rel=stylesheet type=text/css>
</head>
<!--#include file=webhead.asp-->
<div align="center">
	<table border="0" width="780" cellpadding="0" style="border-collapse: collapse" bordercolor="#C0C0C0">
		<tr>
			<td width="200" bgcolor="#F2F2F2" valign="top">
			<table cellSpacing="0" cellPadding="0" width="100%" border="0">
				<tr>
					<td style="PADDING-LEFT: 7px" bgcolor="#C0C0C0" height=21>
					新闻分类</td>
				</tr>
				<tr>
					<td align="middle">
					　</td>
				</tr><%
			set rsn=server.CreateObject("adodb.recordset")
		rsn.Open "select * from newsclass order by classorder",conn,1,1
         do while not rsn.EOF
%><tr>
					<td align="middle" height=20>
					<p align="left">&nbsp;&nbsp;&nbsp;<a href="news.asp?class=<%=rsn("id")%>"><%=rsn("class")%></a>
					　</td>
				</tr> <%rsn.movenext
  loop
  rsn.close
  set rsn=nothing%>
			</table>
								<br>
								<table cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
									<tr>
										<td class="sy-6" width="100%" bgColor="#C0C0C0" height="21" colspan="3">
										&nbsp;新闻排行榜</td>
									</tr><tr>
										<td  height="5"></td></td><td width="23%" >
										　</td>
									</tr>
									<%set rs=server.CreateObject("adodb.recordset")
rs.Open "select top 10  * from news  order by viewcount desc ",conn,1,1
pysjzx_i=1
do while not rs.eof
%>
									
									<tr>
										<td  height="20">
										<div align="center">
											<img src="images/num<%=pysjzx_i%>.gif"></div>
										</td>
										<td  width="65%" height=20 >
										<a target="_blank" href="news_list.asp?id=<%=rs("newsid")%>"><%=left(rs("newsname"),10)%></a>
</td>
										<td  width="23%" >
										<%=rs("viewcount")%></td>
									</tr>
									<%rs.movenext
									pysjzx_i=pysjzx_i+1
									if pysjzx_i >=11 then exit do
									loop%>
								</table>
							</div>
			<p>　</td>
			<td valign="top">
			<div align="center">
			<table border="0" width="95%">
			
				<tr>
					<td>
					<div align="center">
						<table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="location_index">&nbsp;&nbsp;您所在的位置&nbsp;&nbsp;<a href="index.asp">首页</a>&nbsp;&nbsp;<a href="news.asp">新闻</a>&nbsp;&nbsp;<%=newsclass%></td>
      </tr>
    </table></div>
　</td>
				</tr>
			
			</table>
			</div>
			<div align="center">
			<table cellSpacing="1" cellPadding="3" width="95%" border="0">  <%
			
			    set rs2news=server.createobject("adodb.recordset")
    rs2news.open sqlnews,conn,1,1
	if  rs2news.recordcount=0 then 
		else

	  		rs2news.PageSize =24 '每页记录条数
			iCount=rs2news.RecordCount '记录总数
			iPageSize=rs2news.PageSize
    		maxpage=rs2news.PageCount 
    		page=request("page")
    
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if
    
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if
    
    rs2news.AbsolutePage=Page

	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if

	pysjzx_i=1
			For i=1 To x
		%>

					<tr>
						<td>·<a target="_blank" href="news_list.asp?id=<%=rs2news("newsid")%>"><%=rs2news("newsname")%></a>
						
						</td>
					</tr>
					<% 
					if pysjzx_i  mod 10=0 then
				
%>

	<tr>
						<td height=20>
						</td>
					</tr>
<%
					end if
					
pysjzx_i=pysjzx_i+1
       rs2news.movenext
		next
			end if
					%>
					</table></div>
			<div align="center">
				<table border="0" width="95%">
	<tr>
		<td><%	call PageControl(iCount,maxpage,page,"border=0 align=right","<p align=center>")


		rs2news.close
		set rs2news=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
    Dim query, a, x, temp
    action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")

    query = Split(Request.ServerVariables("QUERY_STRING"), "&")
    For Each x In query
        a = Split(x, "=")
        If StrComp(a(0), "page", vbTextCompare) <> 0 Then
            temp = temp & a(0) & "=" & a(1) & "&"
        End If
    Next

    Response.Write("<table " & Table_style & ">" & vbCrLf )        
    Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
    Response.Write("<TD align=right>" & vbCrLf )
    Response.Write(font_style & vbCrLf )    
        
    if page<=1 then     
        Response.Write ("上页 " & vbCrLf)
    else        
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上页</A> " & vbCrLf)
    end if

    if page>=pagecount then
        Response.Write ("下页 " & vbCrLf)    
    else
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下页</A> " & vbCrLf)  
    end if

    Response.Write(" 页次：" & page & "/" & pageCount & "页" &  vbCrLf)
    Response.Write(" 共有" & iCount & "条信息" &  vbCrLf)
    Response.Write("</TD>" & vbCrLf )                
    Response.Write("</TR></form>" & vbCrLf )        
    Response.Write("</table>" & vbCrLf )        
End Sub
%></td>
	</tr>
</table></div>
			</td>
			<td width=1 >
			　</td>
		</tr>
	</table>
</div>
<!--#include file=webfoot.asp-->
</html>