仓酷云

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

[学习教程] ASP网页编程之技能:asp中能够保留参数值的分页代码

[复制链接]
跳转到指定楼层
楼主
发表于 2015-1-16 22:21:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
由于ASP还是一种Script语言所没除了大量使用组件外,没有办法提高其工作效率。它必须面对即时编绎的时间考验,同时我们还不知其背后的组件会是一个什么样的状况;分页|技能<%+++++++++++++++++++++++++++++++++++++++++++++++++++++++
挪用例子
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做网站,开发效率高,使用人数少,减少不必要的开销。交互性是互动方式,是有开发人员决定的。
不帅 该用户已被删除
沙发
发表于 2015-1-19 09:17:25 | 只看该作者
如何学好ASP,以前也有人问过,把回答给你转过来看看能否对你有帮助:
谁可相欹 该用户已被删除
板凳
发表于 2015-1-26 13:18:08 | 只看该作者
我可以结合自己的经验大致给你说一说,希望对你有所帮助,少走些弯路。
只想知道 该用户已被删除
地板
发表于 2015-2-4 16:34:15 | 只看该作者
如何学好ASP,以前也有人问过,把回答给你转过来看看能否对你有帮助:
小妖女 该用户已被删除
5#
发表于 2015-2-10 04:05:21 | 只看该作者
以HTML语言整合(HTML负责界面上,ASP则负责功能上)形成一个B/S(浏览器/服务器)模式的网页程序。
爱飞 该用户已被删除
6#
发表于 2015-2-28 19:17:56 | 只看该作者
先学习用frontpage熟悉html编辑然后学习asp和vbscript建议买书进行系统学习
透明 该用户已被删除
7#
发表于 2015-3-10 06:35:17 | 只看该作者
下载一个源代码,然后再下载一个VBScript帮助,在源代码中遇到不认识的函数或是其他什么程序,都可以查帮助进行解决,这样学习效率很高。
小女巫 该用户已被删除
8#
发表于 2015-3-17 05:09:05 | 只看该作者
兴趣爱好,那么你无须学编程,申请一个域名和空间,在网上下载一些免费开源的CMS系统,你不用改代码,只须熟悉它们的后台操作,像office一样简单方便,很快就能建一个站点,很多站长都是这样做的
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-9-29 01:03

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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