'034 '用途:翻页函数尾数(用于SqlServer存储过程翻页) '参数:totalcount(记录总数),totalpage(总页数),pagenumber(显示几个页码), ' mypagesize(每页显示记录数),page(当前页数),style(为"text"时,带快速跳转框) '示例:call showPage(TotalRecord,totalpage,5,10,page,"text") function showPage(totalcount,totalpage,pagenumber,mypagesize,page,style) dim url,parm,i,s_mid if totalpage<=1 then exit function if clng(page)<1 then page = 1 if clng(page)>clng(totalpage) then page=totalpage if pagenumber="" then pagenumber=10 if lcase(trim(style))="" then style="none" url = request.ServerVariables("url") parm = request.ServerVariables("Query_String") parm = deleteparm(parm,"page") if parm<>"" then url = url & "?" & parm & "&" else url = url & "?" end if showPage= "
共有" & totalcount & "条,第:" & page & "页/共" & totalpage & "页," & mypagesize & "/每页 | " '处理首页问题 if page>1 then showPage = showPage & "" showPage = showPage & "" end if s_mid = 0 s_mid = clng(pagenumber\2) if pagenumber mod 2 <>0 then s_mid = s_mid+1 if clng(page)<=clng(totalpage) and clng(page)>=clng(s_mid) then '处理中间页码的生成问题 for i=page-s_mid+1 to page-s_mid+pagenumber if i<=totalpage then if clng(i)=clng(page) then showPage = showPage & " [" & i & "]" else showPage = showPage & " " & i & "" end if end if next end if if page>=1 and clng(page)[" & i & "]" else showPage = showPage & " " & i & "" end if end if next end if if clng(page)" showPage = showPage & "" end if showPage = showPage & " | " if style="text" then if right(url,1)="?" or right(url,1)="&" then url = left(url,len(url)-1) showPage = showPage & "
" else showPage = showPage & "" end if Response.write showPage end function