kellynic写的一个分页模块

 

kellynic写的一个分页模块

 还可以,给大家参考

程序代码
< %
' 显示上下页(当前页,总页数,前后加起来的页数,除去cp参数的GET串)
function  showPage(currentPage,countPage,showPageC,queryStr)
    
dim  i,l,starF,endF,reStr,getStr
    
const  DOT = " <span style=cursor:hand;>..</span> "
    l
= showPageC 2
    
if  currentPage - l <= 1   then
    starF
= 1
    
else
        starF
= currentPage - l
        reStr
= reStr  &  DOT
    
end   if
    endF
= starF + showPageC
    
for  i = starF  to  endF
        
if  i > countPage  then   exit   for
        
if  queryStr = ""   then
        getStr
= " cp= "   &  i
        
else
        getStr
= queryStr  &   " &cp= "   &  i
        
end   if
        
if  i <> currentPage  then
        reStr
= reStr  &   " <a href= " / " ? "   &  getStr  &   " "" target=_self class=page>[ "   &  i  &   " ]</a>  "
        
else
        reStr
= reStr  &   " <b><font color=#CC9933>[ "   &  i  &   " ]</a></b>  "
        
end   if
    
next
    
if  endF < countPage  then  reStr = reStr  &  DOT
    reStr
= reStr  &   " <span class=green>  "   &  currentPage  &   " / "   &  countPage  &   "   "   &  showTablePageSize  &   " /页</span>  "
' *****************************************************
     if  queryStr = ""   then
        getStr
= " cp=1 "
    
else
        getStr
= queryStr  &   " &cp=1 "
    
end   if
    
if  currentPage > 1   then
        reStr
= reStr  &   " <a href= " / " ? "   &  getStr  &   " "" target=_self class=page>首页</a>  "
    
else
        reStr
= reStr  &   " <font color=#CCCCCC>首页</font>  "
    
end   if
' *****************************************************
     if  queryStr = ""   then
        getStr
= " cp= "   &  (currentPage - 1 )
    
else
        getStr
= queryStr  &   " &cp= "   &  (currentPage - 1 )
    
end   if
    
if  currentPage > 1   then
        reStr
= reStr  &   " <a href= " / " ? "   &  getStr  &   " "" target=_self class=page>上页</a>  "
    
else
        reStr
= reStr  &   " <font color=#CCCCCC>上页</font>  "
    
end   if
' *****************************************************
     if  queryStr = ""   then
        getStr
= " cp= "   &  (currentPage + 1 )
    
else
        getStr
= queryStr  &   " &cp= "   &  (currentPage + 1 )
    
end   if
    
if  currentPage < countPage  then
        reStr
= reStr  &   " <a href= " / " ? "   &  getStr  &   " "" target=_self class=page>下页</a>  "
    
else
        reStr
= reStr  &   " <font color=#CCCCCC>下页</font>  "
    
end   if
' *****************************************************
     if  queryStr = ""   then
        getStr
= " cp= "   &  countPage
    
else
        getStr
= queryStr  &   " &cp= "   &  countPage
    
end   if
    
if  currentPage < countPage  then
        reStr
= reStr  &   " <a href= " / " ? "   &  getStr  &   " "" target=_self class=page>末页</a>  "
    
else
        reStr
= reStr  &   " <font color=#CCCCCC>末页</font>  "
    
end   if
' *****************************************************
    showPage = reStr
    
end function

' 过滤所有的GET串中的cp(当前页数据值),保留其它参数值
function  allQueryString()
    
dim  queryTemp,queryT,query
    queryTemp 
=  Request.ServerVariables( " QUERY_STRING " )
    
if  queryTemp  <>   ""   then
        
if   instr (queryTemp, " & " ) <> 0   then
        queryTemp 
=   split (queryTemp, " & " )
        
dim  queryI
        
for  queryI  =   LBound (queryTemp)  to   UBound (queryTemp)
            queryT 
=   split (queryTemp(queryI), " = " )
            
if  queryT( 0 ) <> " cp "   then
            query 
=  query  &  queryTemp(queryI)  &   " & "
            
end   if
        
next
        query 
=   left (query, len (query) - 1 )
        
else
        queryTemp 
=   split (queryTemp, " = " )
        
if  queryTemp( 0 ) <> " cp "   then
            query 
=  queryTemp( 0 &   " = "   &  queryTemp( 1 )
        
end   if
        
end   if
    
end   if
    allQueryString 
=  query
end function

' 数据显示完毕后只需这两行代码即可,通用性还可以
query  =  allQueryString()
response.Write(showPage(showTableCurrentPage,showTableCountPage,
9 ,query))
%
>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值