1. 北京網站建設分頁代碼

      2011-07-05


      .fen1{ width:700px; height:20px; float:left; display:inline; text-align:center; margin-

      left:4px; margin-top:7px;}
      .fen1 a.aab{  border:#CCCCCC solid 1px;  text-align:center; padding:2px 5px; }
      .fen1 a:hover.aab{  border:#DC9861 solid 1px; color:#000000;}
      .fen1 a.aac{  border:#DC9861 solid 1px; color:#993300;text-align:center; padding:2px 5px;}
      .fen1 a,.fen1 span{  border:#CCCCCC solid 1px;  text-align:center; padding:2px 5px;

      width:100px; color:#666666;}

       

       

       

      <%a=request("a")
      b=request("b")%>

         <%
      page=clng(request("page"))  
      Set rs=Server.CreateObject("ADODB.RecordSet")

      if b <> "" then
      sql="select * from product where a='"&a&"' and b='"&b&"'  order by id desc"
      elseif a<>"" then
      sql="select * from product where a='"&a&"' and b='"&b&"'  order by id desc"
      else
      sql="select * from product where a=9   order by id desc"
      end if
      rs.Open sql,conn,1,1

      if rs.eof and rs.bof then
        response.Write("暫時沒有記錄")
      else
      %>
       
       
       <%
      rs.PageSize=10
      eee=10
      fff=INT(eee/2)
      if page=0 then page=1
      pages=rs.pagecount
      if page > pages then page=pages
      rs.AbsolutePage=page 
      for j=1 to rs.PageSize
      %>



       
       
      <%
      rs.movenext
      if rs.eof then exit for
      next
      %>

       


       

       


                                <%if Page<2 then     
          response.write "首頁 上一頁 "
        else
          response.write "首頁 "
          response.write "上一頁

       "
        end if %>
       
       
       
        <%if page="" then
        page=1
        end if%>
       
       
       
         <%if rs.pagecount <= eee then %>
         <% for ccc=1 to rs.pagecount%>  
          <%if ccc=page then%>
        <%=ccc%>
        <%else%>
        <%=ccc%>
        <%end if%>
        <%next%> 
        <%elseif rs.pagecount >eee then%> 
        <%if page < fff+1 then %> 
         <% for bb=1 to eee%>
        <%if bb=page then%>
        <%=bb%>
        <%else%>
        <%=bb%>
        <%end if%>
         <%next%>   
           <%else%>
        <%aaa=page-fff%>
          <%bbb=page+fff%>
       <%if bbb > rs.pagecount then
       bbb=rs.pagecount
       end if%> 
       <%if page > rs.pagecount-fff then %>
       <%ddd=bbb-eee%>
       <% for bb=ddd to bbb%>  
          <%if bb=page then%>
        <%=bb%>
        <%else%>
        <%=bb%>
        <%end if%>
        <%next%>
        <%else%>
         <% for bb=aaa to bbb%>  
          <%if bb=page then%>
        <%=bb%>
        <%else%>
        <%=bb%>
        <%end if%>
        <%next%>
        <%end if%>
       <%end if%>
      <%end if%>  
        <%
        if rs.pagecount-page<1 then
          response.write "下一頁 尾頁"
        else
          response.write ""
          response.write "下一頁

      尾頁"
        end if
        'response.write " 頁次:

      color=red>"&Page&"/"&rs.pagecount&"頁 "
          'response.write " 共"&rs.recordcount&"條記錄

      "&rs.pagesize&"條記錄/頁"
         'response.write " 轉到:

      value="&page&">"
        ' response.write "

      name='cndok'>

      "    
      %>
                             
        <%
      end if
      rs.close
      set rs=nothing
      %>