• 北京网站建设分页代码

    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
    %>