<%sub listpages(mycondition)
    if pages<1 then
        exit sub
    end if
    response.write "<div class='pages'>&nbsp;"&(p*10+currentpage)&"/"&Pages&"&nbsp;共<b>"&Records&"</b>条记录</div>"
    if (p*10+currentpage)>1 then
        response.write "<div class='button'><a href='"&request.ServerVariables("script_name")&"?currentpage=1&&p=0"&mycondition&"' title='头页'><img src='images/btn_previouspage.gif'></a></div>" 
    end if
    '===首页
    if p>0 and currentpage=1 then
        response.write  "<div class='button'><a href="&request.ServerVariables("script_name")&"?currentpage=10&p="&p-1&mycondition&" title='上一页'><img src='images/btn_uppage.gif'></a></div>"
    elseif currentpage>1 then
        response.write  "<div class='button'><a href="&request.ServerVariables("script_name")&"?currentpage="&currentpage-1&"&p="&p&mycondition&" title='上一页'><img src='images/btn_uppage.gif'></a></div>"
    end if
    '===上页
    response.write "<ul class='pagetab'>"

    if p>0 then
        response.write    "<li><a href='"&request.ServerVariables("script_name")&"?currentpage=10&p="&p-1&mycondition&"' title='上十页'>上十页</a></li>"
    end if
    '-------------------下面写出当前十个页码
    for i=1 to 10
        if (p*10+i)>pages then exit for
        if currentpage=i then
            response.write "<li class='current'><a "
        else
            response.write "<li><a "
        end if 
        response.write "href='"&request.ServerVariables("script_name")&"?currentpage="&i&"&p="&p&mycondition&"'>"&(p*10+i)&"</a></li>"    
     next
     '--------------------察看下十页的连接
    if (p*10+10)<pages then
        response.write "<a href='"&request.ServerVariables("script_name")&"?currentpage=1&p="&p+1&mycondition&"' title='下十页'>下十页</a>" 
    end if
    '-----------------------------------------------上下页导航
    response.write "</ul>"

    if (p*10+currentpage)<pages and currentpage=10 then
        response.write  "<div class='button'><a href='"&request.ServerVariables("script_name")&"?currentpage=1&p="&p+1&mycondition&"' title='下一页'><img src='images/btn_dowmpage.gif'></a></div>"
    elseif (p*10+currentpage)<pages then
        response.write  "<div class='button'><a href='"&request.ServerVariables("script_name")&"?currentpage="&currentpage+1&"&p="&p&mycondition&"' title='下一页'><img src='images/btn_dowmpage.gif'></a></div>"
    end if
    '===下页

      if (p*10+currentpage)<pages then
        response.write "<div class='button'><a href='"&request.ServerVariables("script_name")&"?currentpage="&((pages-1) mod 10)+1&"&p="&((pages-1)\10)&mycondition&"' title='尾页'><img src='images/btn_dowmpreviouspage.gif'></a></div>"
      end if
      '===尾页

end sub

sub myPages(myRS,mysize)  '------mysize为内部变量（主页面没有定义），myRS为主页面传递过来的RS对象（地址传递）
    if myRS.eof and myRS.bof then str="没有纪录"
    if str="" then
        if mysize="" or NOT IsNumeric(mysize) then
            mysize=15
        end if
        myRS.PageSize=mysize
        pages=myRS.pagecount
        records=myRS.recordcount
        On Error Resume Next '取得数字
        currentPage=request("currentPage")
        if currentPage="" then
            currentPage=1
        end if
        currentPage=CInt(currentPage)
        if Err.Number <> 0 Then
            currentPage=1
            Err.Clear
        end if
        if currentPage<1 then
            currentPage=1
        elseIf currentPage>10 then
            currentPage=10
        end if
        '----------------处理p
        p=request("p")
        if p="" then
            p=0
        end if
        p=CLng(p)
        if Err.Number <> 0 Then
            p=0
            Err.Clear
        end if
        if p<0 then
            p=0
        end if
        '--判断是否出了页数范围
        nowPage=p*10+currentPage
        if nowPage>pages then
            p=(pages-1)\10
            currentPage=((pages-1) mod 10)+1
        end if
        myRS.absolutepage=p*10+currentPage
    else
       currentPage=1
       records=0
       pages=1
    end if
end sub
dim pages,records,currentPage,p '--------定义变量，这些变量在主页面中，进行地址传递%>