<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<%
sql="select * from news order by id desc"
rs.open sql,conn,1,1

%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>苏州润达蔬果配送中心</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>

<body>
<!--#include file="top.asp" -->
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
	<div class="left"><!--#include file="indexleft.asp" --></div>
	<div class="nr1">
	 <div class="leftt">您现在的位置是：>> <a href="index.asp">首页</a>>> 市场资讯</div>
	  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="74B145">
       <tr>
         <td bgcolor="#FFFFFF">
		     
			<table width="100%" height="101" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                   <td height="28"><img src="images/sg.jpg" width="713" height="28"></td>
                 </tr>
				  <tr>
				   <td><br>
				     <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                     <%
					 rs.PageSize =18 '每页记录条数
			iCount=rs.RecordCount '记录总数
			iPageSize=rs.PageSize
    		maxpage=rs.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
    rs.AbsolutePage=Page
	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if
	  %><%if  not rs.eof then
  for n=1 to rs.pagesize%>
					 <tr>
                       <td width="7%"><div align="center"><img src="images/news_icon.gif" width="9" height="9" align="absmiddle"></div></td>
                       <td width="59%" height="25"><a href="newsinfo.asp?id=<%=rs("id")%>"><%=rs("title")%></a></td>
                       <td width="34%"><%=rs("time")%></td>
                     </tr>
					 <tr>
                       <td height="3" colspan="3" background="images/spec_line.jpg"></td>
                       </tr>
					 <%
 rs.movenext
 if rs.eof then
 exit for
 end if
next
  else
   response.Write  "<tr><td>暂无产品!</td></tr>"
end if  
  %>             
                     
                     <tr>
                       <td colspan="3"><%
		call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
		
		rs.close
		set rs=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 width=100% border=0 cellpadding=0 cellspacing=0 >" & vbCrLf )        
    Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR >" & vbCrLf )
    Response.Write("<TD align=center height=40>" & vbCrLf )
    Response.Write(font_style & vbCrLf )    
    if page<=1 then
        Response.Write ("首 页 " & vbCrLf)        
        Response.Write ("上一页 " & vbCrLf)
    else        
        Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首 页</A> " & vbCrLf)
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上一页</A> " & vbCrLf)
    end if
    if page>=pagecount then
        Response.Write ("下一页 " & vbCrLf)
        Response.Write ("尾 页 " & vbCrLf)            
    else
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下一页</A> " & vbCrLf)
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">尾 页</A> " & vbCrLf)            
    end if
    Response.Write(" 页次：" & page & "/" & pageCount & "页" &  vbCrLf)
    Response.Write(" 共有" & iCount & "条新闻" &  vbCrLf)
    Response.Write(" 转到" & "<INPUT CLASS=wenbenkuang TYEP=TEXT NAME=page SIZE=2 Maxlength=5 VALUE=" & page & ">" & "页"  & vbCrLf & "<INPUT CLASS=go-wenbenkuang type=submit value=GO>")
    Response.Write("</TD>" & vbCrLf )                
    Response.Write("</TR></form>" & vbCrLf )        
    Response.Write("</table>" & vbCrLf )        
End Sub
%></td>
                      </tr>
                     <tr>
                       <td>&nbsp;</td>
                       <td>&nbsp;</td>
                       <td>&nbsp;</td>
                     </tr>
                   </table>			       </td>
	             </tr>
	       </table>
		 </td>
	   </tr>
	 </table>
	
	</div>
	
	
	</td>
  </tr>
</table>
<!--#include file="foot.asp" -->
</body>
</html>
