仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 809|回复: 8
打印 上一主题 下一主题

[学习教程] ASP网页设计asp中能够保留参数值的分页代码

[复制链接]
小妖女 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 22:19:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
Access是一种桌面数据库,只适合数据量少的应用,在处理少量数据和单机访问的数据库时是很好的,效率也很高。但是它的同时访问客户端不能多于4个。access数据库有一定的极限,如果数据达到100M左右,很容易造成服务器iis假死,或者消耗掉服务器的内存导致服务器崩溃。分页<%+++++++++++++++++++++++++++++++++++++++++++++++++++++++
挪用例子
Dimint_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_="<fontface=webdings>9</font>"首页
toP10_="<fontface=webdings>7</font>"上十
toP1_="<fontface=webdings>3</font>"上一
toN1_="<fontface=webdings>4</font>"下一
toN10_="<fontface=webdings>8</font>"下十
toL_="<fontface=webdings>:</font>"尾页
============================================
这段代码必定要在VClass_Rs.Open与for轮回之间
SetVClass_Rs=CreateObject(G_FS_RS)
VClass_Rs.OpenThis_Fun_Sql,User_Conn,1,1
IFnotVClass_Rs.eofTHEN
VClass_Rs.PageSize=int_RPP
cPageNo=NoSqlHack(Request.QueryString("Page"))
IfcPageNo=""ThencPageNo=1
Ifnotisnumeric(cPageNo)ThencPageNo=1
cPageNo=Clng(cPageNo)
IfcPageNo<=0ThencPageNo=1
IfcPageNo>VClass_Rs.PageCountThencPageNo=VClass_Rs.PageCount
VClass_Rs.AbsolutePage=cPageNo
FORint_Start=1TOint_RPP
++++++++++
加轮回体显现数据
++++++++++
VClass_Rs.MoveNext
ifVClass_Rs.eoforVClass_Rs.bofthenexitfor
NEXT
ENDIF
============================================
response.Write"<p>"&fPageCount(VClass_Rs,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*********************************************************
目标:分页的页面参数坚持
提交查询的分歧性
输出:moveParam:分页参数
removeList:要移除的参数
前往:分页Url
*********************************************************
FunctionPageUrl(moveParam,removeList)
dimstrName
dimKeepUrl,KeepForm,KeepMove
removeList=removeList&","&moveParam
KeepForm=""
ForEachstrNameinRequest.Form
判别form参数中的submit、空值
ifnotInstrRev(","&removeList&",",","&strName&",",-1,1)>0andRequest.Form(strName)""then
KeepForm=KeepForm&"&"&strName&"="&Server.URLencode(Request.Form(strName))
endif
removeList=removeList&","&strName
Next

KeepUrl=""
ForEachstrNameInRequest.QueryString
Ifnot(InstrRev(","&removeList&",",","&strName&",",-1,1)>0)Then
KeepUrl=KeepUrl&"&"&strName&"="&Server.URLencode(Request.QueryString(strName))
EndIf
Next

KeepMove=KeepForm&KeepUrl

If(KeepMove"")Then
KeepMove=Right(KeepMove,Len(KeepMove)-1)
KeepMove=Server.HTMLEncode(KeepMove)&"&"
EndIf

PageUrl=replace(Request.ServerVariables("URL"),"/Search.asp","/Search.html")&"?"&KeepMove&moveParam&"="
PageUrl="?"&KeepMove&moveParam&"="
EndFunction

FunctionfPageCount(Page_Rs,showNumberLink_,nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,Page)
DimThis_Func_Get_Html_,toPage_,p_,sp2_,I,tpagecount
DimNaviLength,StartPage,EndPage
This_Func_Get_Html_="":I=1
NaviLength=showNumberLink_
ifIsEmpty(showMorePageGo_Type_)thenshowMorePageGo_Type_=1
tpagecount=Page_Rs.pagecount
IftPageCount<1ThentPageCount=1
ifnotPage_Rs.eofornotPage_Rs.bofthen
toPage_=PageUrl("Page","submit,GetType,no-cache,_")
ifPage=1then
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""首页"">"&toF_&"</font>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&"1title=""首页"">"&toF_&"</a>"&vbNewLine
EndIf
ifPage<NaviLengththen
StartPage=1
else
StartPage=fix(Page/NaviLength)*NaviLength
endif
EndPage=StartPage+NaviLength-1
IfEndPage>tPageCountThenEndPage=tPageCount
IfStartPage>1Then
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&Page-NaviLength&"title=""上"&int_showNumberLink_&"页"">"&toP10_&"</a>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""上"&int_showNumberLink_&"页"">"&toP10_&"</font>"&vbNewLine
EndIf
IfPage1andPage0Then
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&(Page-1)&"title=""上一页"">"&toP1_&"</a>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""上一页"">"&toP1_&"</font>"&vbNewLine
EndIf
ForI=StartPageToEndPage
IfI=PageThen
This_Func_Get_Html_=This_Func_Get_Html_&"<b>"&I&"</b>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&I&">"&I&"</a>"&vbNewLine
EndIf
IfItPageCountThenThis_Func_Get_Html_=This_Func_Get_Html_&vbNewLine
Next
IfPagePage_Rs.PageCountandPage0Then
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&(Page+1)&"title=""下一页"">"&toN1_&"</a>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""下一页"">"&toN1_&"</font>"&vbNewLine
EndIf
IfEndPage<tpagecountThen
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&Page+NaviLength&"title=""下"&int_showNumberLink_&"页"">"&toN10_&"</a>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""下"&int_showNumberLink_&"页"">"&toN10_&"</font>"&vbNewLine
EndIf
ifPage_Rs.PageCountPagethen
This_Func_Get_Html_=This_Func_Get_Html_&"<ahref="&toPage_&Page_Rs.PageCount&"title=""尾页"">"&toL_&"</a>"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"<fontcolor="&nonLinkColor_&"title=""尾页"">"&toL_&"</font>"&vbNewLine
EndIf
IfshowMorePageGo_Type_=1then
DimShow_Page_i
Show_Page_i=Page+1
ifShow_Page_i>tPageCountthenShow_Page_i=1
This_Func_Get_Html_=This_Func_Get_Html_&"<inputtype=""text""size=""4""maxlength=""10""name=""Func_Input_Page""this.focus();""this.value="&Show_Page_i&";""onKeyUp=""value=value.replace(/[^1-9]/g,)""onbeforepaste=""clipboardData.setData(text,clipboardData.getData(text).replace(/[^1-9]/g,))"">"&vbNewLine_
&"<inputtype=""button""value=""Go""Func_Input_Page.focus();""javascript:varJs_JumpValue;Js_JumpValue=document.all.Func_Input_Page.value;if(Js_JumpValue==||!isNaN(Js_JumpValue))location="&topage_&"+Js_JumpValue;elselocation="&topage_&"1;"">"&vbNewLine
Else
This_Func_Get_Html_=This_Func_Get_Html_&"跳转:<selectNAME=menu1onChange=""varJs_JumpValue;Js_JumpValue=this.options[this.selectedIndex].value;if(Js_JumpValue!=)location=Js_JumpValue;"">"
fori=1totPageCount
This_Func_Get_Html_=This_Func_Get_Html_&"<optionvalue="&topage_&i
ifPage=ithenThis_Func_Get_Html_=This_Func_Get_Html_&"selectedstyle=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
Endif
This_Func_Get_Html_=This_Func_Get_Html_&p_&sp2_&"每页<b>"&Page_Rs.PageSize&"</b>个纪录,如今是:<b><spanclass=""tx"">"&sp2_&Page&"</span>/"&tPageCount&"</b>页,共<b><spanid=recordcount>"&sp2_&Page_Rs.recordCount&"</span></b>个纪录。"
else
没有纪录
endif
fPageCount=This_Func_Get_Html_
EndFunction
%>
asp是基于web的一种编程技术,可以说是cgi的一种。它可以完成以往cgi程序的所有功能,如计数器、留言簿、公告板、聊天室等等。
深爱那片海 该用户已被删除
沙发
发表于 2015-1-19 08:48:40 | 只看该作者
下面简单介绍一下我学习ASP的方法,希望对想学习ASP的朋友有所帮助...
变相怪杰 该用户已被删除
板凳
发表于 2015-1-28 05:53:48 | 只看该作者
如何更好的使自己的东西看上去很不错等等。其实这些都不是问题的实质,我们可以在实践中不断提升自己,不断充实自己。
因胸联盟 该用户已被删除
地板
发表于 2015-2-5 16:55:16 | 只看该作者
完全不知道到底自己学的是什么。最后,除了教程里面说的几个例子,还是什么都不会。
小女巫 该用户已被删除
5#
发表于 2015-2-13 01:44:50 | 只看该作者
如何学好ASP,以前也有人问过,把回答给你转过来看看能否对你有帮助:
兰色精灵 该用户已被删除
6#
发表于 2015-3-3 12:40:55 | 只看该作者
作为IE上广为流传的动态网页开发技术,ASP以它简单易学博得了广大WEB程序爱好这的青睐,而且它对运行环境和开发品台的不挑剔,以及有大量有效的参考手册,极大的推广了它的发展。
飘飘悠悠 该用户已被删除
7#
发表于 2015-3-11 11:11:27 | 只看该作者
你可以通过继承已有的对象最大限度保护你以前的投资。并且C#和C++、Java一样提供了完善的调试/纠错体系。
山那边是海 该用户已被删除
8#
发表于 2015-3-18 09:01:55 | 只看该作者
如何更好的使自己的东西看上去很不错等等。其实这些都不是问题的实质,我们可以在实践中不断提升自己,不断充实自己。
再见西城 该用户已被删除
9#
发表于 2015-3-25 16:14:17 | 只看该作者
ASP也是这几种脚本语言中最简单易学的开发语言。但ASP也是这几种语言中唯一的一个不能很好支持跨平台的语言。  因为ASP脚本语言非常简单,因此其代码也简单易懂,结合HTML代码,可快速地完成网站的应用程序。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-5 23:43

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表