asp可设置参数的分页代码例子
发布时间:2007-10-07 12:34:00
<%
''调用例子
'Dim int_RPP,int_Start,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo
'int_RPP=2 '设置每页显示数目
'int_showNumberLink_=8 '数字导航显示数目
'showMorePageGo_Type_ = 1 '是下拉菜单还是输入值跳转,当多次调用时只能选1
'str_nonLinkColor_="#999999" '非热链接颜色
'toF_="<font face=webdings>9</font>" '首页
'toP10_=" <font face=webdings>7</font>" '上十
'toP1_=" <font face=webdings>3</font>" '上一
'toN1_=" <font face=webdings>4</font>" '下一
'toN10_=" <font face=webdings>8</font>" '下十
'toL_="<font face=webdings>:</font>" '尾页
'这段代码一定要在VClass_Rs.Open 与 for循环之间
' Set VClass_Rs = CreateObject(G_FS_RS)
' VClass_Rs.Open This_Fun_Sql,User_Conn,1,1
' IF not VClass_Rs.eof THEN
' VClass_Rs.PageSize=int_RPP
' cPageNo=NoSqlHack(Request.QueryString("Page"))
' If cPageNo="" Then cPageNo = 1
' If not isnumeric(cPageNo) Then cPageNo = 1
' cPageNo = Clng(cPageNo)
' If cPageNo<=0 Then cPageNo=1
' If cPageNo>VClass_Rs.PageCount Then cPageNo=VClass_Rs.PageCount
' VClass_Rs.AbsolutePage=cPageNo
' FOr int_Start=1 TO int_RPP
''++++++++++
'加循环体显示数据
''++++++++++
' VClass_Rs.MoveNext
' if VClass_Rs.eof or VClass_Rs.bof then exit for
' NEXT
' END IF
'response.Write "<p>"& fPageCount(VClass_Rs,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo)
' 目的:分页的页面参数保持
' 提交查询的一致性
' 输入:moveParam:分页参数
' removeList:要移除的参数
' 返回:分页Url
Function PageUrl(moveParam,removeList)
dim strName
dim KeepUrl,KeepForm,KeepMove
removeList=removeList&","&moveParam
KeepForm=""
For Each strName in Request.Form
'判断form参数中的submit、空值
if not InstrRev(","&removeList&",",","&strName&",", -1, 1)>0 and Request.Form(strName)<>"" then
KeepForm=KeepForm&"&"&strName&"="&Server.URLencode(Request.Form(strName))
end if
removeList=removeList&","&strName
Next
KeepUrl=""
For Each strName In Request.QueryString
If not (InstrRev(","&removeList&",",","&strName&",", -1, 1)>0) Then
KeepUrl = KeepUrl & "&" & strName & "=" & Server.URLencode(Request.QueryString(strName))
End If
Next
KeepMove=KeepForm&KeepUrl
If (KeepMove <> "") Then
KeepMove = Right(KeepMove, Len(KeepMove) - 1)
KeepMove = Server.HTMLEncode(KeepMove) & "&"
End If
'PageUrl = replace(Request.ServerVariables("URL"),"/Search.asp","/Search.html") & "?" & KeepMove & moveParam & "="
PageUrl = "?" & KeepMove & moveParam & "="
End Function
Function fPageCount(Page_Rs,showNumberLink_,nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,Page)
Dim This_Func_Get_Html_,toPage_,p_,sp2_,I,tpagecount
Dim NaviLength,StartPage,EndPage
This_Func_Get_Html_ = "" : I = 1
NaviLength=showNumberLink_
if IsEmpty(showMorePageGo_Type_) then showMorePageGo_Type_ = 1
tpagecount=Page_Rs.pagecount
If tPageCount<1 Then tPageCount=1
if not Page_Rs.eof or not Page_Rs.bof then
toPage_ = PageUrl("Page","submit,GetType,no-cache,_")
if Page=1 then
This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""首页"">"&toF_&"</font> " &vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_&"1 title=""首页"">"&toF_&"</a> " &vbNewLine
End If
if Page<NaviLength then
StartPage = 1
else
StartPage = fix(Page / NaviLength) * NaviLength
end if
EndPage=StartPage+NaviLength-1
If EndPage>tPageCount Then EndPage=tPageCount
If StartPage>1 Then
This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_& Page - NaviLength &" title=""上"&int_showNumberLink_&"页"">"&toP10_&"</a> " &vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""上"&int_showNumberLink_&"页"">"&toP10_&"</font> " &vbNewLine
End If
If Page <> 1 and Page <>0 Then
This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_&(Page-1)&" title=""上一页"">"&toP1_&"</a> " &vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""上一页"">"&toP1_&"</font> " &vbNewLine
End If
For I=StartPage To EndPage
If I=Page Then
This_Func_Get_Html_=This_Func_Get_Html_& "<b>"&I&"</b>" &vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_&I&">" &I& "</a>" &vbNewLine
End If
If I<>tPageCount Then This_Func_Get_Html_=This_Func_Get_Html_& vbNewLine
Next
If Page <> Page_Rs.PageCount and Page <>0 Then
This_Func_Get_Html_=This_Func_Get_Html_& " <a href="&toPage_&(Page+1)&" title=""下一页"">"&toN1_&"</a> " &vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""下一页"">"&toN1_&"</font> " &vbNewLine
End If
If EndPage<tpagecount Then
This_Func_Get_Html_=This_Func_Get_Html_& " <a href="&toPage_& Page + NaviLength &" title=""下"&int_showNumberLink_&"页"">"&toN10_&"</a> " &vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_& " <font color="&nonLinkColor_&" title=""下"&int_showNumberLink_&"页"">"&toN10_&"</font> " &vbNewLine
End If
if Page_Rs.PageCount<>Page then
This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_&Page_Rs.PageCount&" title=""尾页"">"&toL_&"</a>" &vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""尾页"">"&toL_&"</font>" &vbNewLine
End If
If showMorePageGo_Type_ = 1 then
Dim Show_Page_i
Show_Page_i = Page + 1
if Show_Page_i > tPageCount then Show_Page_i = 1
This_Func_Get_Html_=This_Func_Get_Html_& "<input type=""text"" size=""4"" maxlength=""10"" name=""Func_Input_Page"" onmouseover=""this.focus();"" onfocus=""this.value='"&Show_Page_i&"';"" onKeyUp=""value=value.replace(/[^1-9]/g,'')"" onbeforepaste=""clipboardData.setData('text',clipboardData.getData('text').replace(/[^1-9]/g,''))"">" &vbNewLine _
&"<input type=""button"" value=""Go"" onmouseover=""Func_Input_Page.focus();"" onclick=""javascript:var Js_JumpValue;Js_JumpValue=document.all.Func_Input_Page.value;if(Js_JumpValue=='' || !isNaN(Js_JumpValue)) location='"&topage_&"'+Js_JumpValue; else location='"&topage_&"1';"">" &vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_& " 跳转:<select NAME=menu1 onChange=""var Js_JumpValue;Js_JumpValue=this.options[this.selectedIndex].value;if(Js_JumpValue!='') location=Js_JumpValue;"">"
for i=1 to tPageCount
This_Func_Get_Html_=This_Func_Get_Html_& "<option value="&topage_&i
if Page=i then This_Func_Get_Html_=This_Func_Get_Html_& " selected style='color:#0000FF'"
This_Func_Get_Html_=This_Func_Get_Html_& ">第"&cstr(i)&"页</option>" &vbNewLine
next
This_Func_Get_Html_=This_Func_Get_Html_& "</select>" &vbNewLine
End if
This_Func_Get_Html_=This_Func_Get_Html_& p_&sp2_&" 每页<b>"&Page_Rs.PageSize&"</b>个记录,现在是:<b><span class=""tx"">"&sp2_&Page&"</span>/"&tPageCount&"</b>页,共<b><span id='recordcount'>"&sp2_&Page_Rs.recordCount&"</span></b>个记录。"
else
'没有记录
end if
fPageCount = This_Func_Get_Html_
End Function
%>
猜你喜欢
- 本文适用场景:想用Tkinter开发界面程序并屏幕居中,但没找到相应的API。这两天玩了玩Tkinter,感觉不错,就是屏幕居中这个问题在网
- 概念panic 与 recover 是 Go 的两个内置函数,这两个内置函数用于处理 Go 运行时的错误。panic用于主动抛出错误, re
- 用游标,和WHILE可以遍历您的查询中的每一条记录并将要求的字段传给变量进行相应的处理==================DECLARE @
- 本文实例为大家分享了Vue+ Antv F2实现层叠柱状图的具体代码,供大家参考,具体内容如下一、 创建canvas标签<canvas
- 前期准备1.beat插件安装pip3 install django-celery-beat2.注册APPINSTALLED_APPS = [
- 本文主要介绍了django admin search_fields placeholder 管理后台添加搜索框提示文字,分享给大家,具体如下
- 今天在部署一个实验系统的时候,报出下面这个错: Your 'max_allowed_packet' variable is
- 本文实例为大家分享了js实现简单放大镜特效的具体代码,供大家参考,具体内容如下先来看看效果:写放大镜之前我们先来了解一下定位:通常子绝父相
- 今天在数据分析时遇到了一个小问题,这时才发现自己的基础知识真的不牢固,所以这里记录一下解决方法问题:我在处理完数据后得到的是一个列表,其中放
- 以前在一个图书类网站看到这样一个功能:客户可以按条件搜索书目的信息,服务器会将符合条件的信息筛选出来保存为一个Excel文件供客户下载。今天
- PS:这段时间有点不在状态,刚刚找回那个状态,那么我们继续曾经的梦想今天我们来补充一下文件的上传的几种方式:首先我们先补充的一个知识点:一、
- 我们在开发程序的时候,有时候需要开发一些自动化的任务,执行完之后,将结果自动的发送一份邮件,python发送邮件使用smtplib模块,是一
- 我为 Compose 写了一个波浪效果的进度加载库,API 的设计上符合 Compose 的开发规范,使用非常简便。1. 使用方式在 roo
- 本文实例为大家分享了python matlibplot绘制3D图形的具体代码,供大家参考,具体内容如下1、散点图使用scatterfrom
- pyecharts 是一个用于生成 Echarts 图表的类库。Echarts 是百度开源的一个数据可视化 JS 库。用 Echarts 生
- 但凡有些事情重复时,我就在想怎么可以用程序来自动化。这里想分享如何每天给女友定时微信发送”晚安“,如果只是晚安,就略显单调,于是爬取金山词霸
- OpenCV 对象跟踪这篇文章使用 OpenCV 中内置的八种不同的对象跟踪算法,实现对物体的跟踪。首先,介绍一下8种跟踪算法。然后,演示如
- #!/usr/bin/env python# name IsOpen.pyimport osimport socketdef IsOpen(
- 这是去年毕设做的一个Web漏洞扫描小工具,主要针对简单的SQL注入漏洞、SQL盲注和XSS漏洞,代码是看过github外国大神(听说是SMA
- 版本信息:python:3.6mysql:5.7pyMysql:0.7.11################################