asp

位置:IT落伍者 >> asp >> 浏览文章

ASP程序实现可以保存参数值的分页功能


发布日期:2021年04月07日
 
ASP程序实现可以保存参数值的分页功能

<%+++++++++++++++++++++++++++++++++++++++++++++++++++++++

调用例子

Dim int_RPPint_Startint_showNumberLink_str_nonLinkColor_toF_toP_toP_toN_toN_toL_showMorePageGo_Type_cPageNo

int_RPP= 设置每页显示数目

int_showNumberLink_= 数字导航显示数目

showMorePageGo_Type_ = 是下拉菜单还是输入值跳转当多次调用时只能选

str_nonLinkColor_=# 非热链接颜色

toF_=<font face=webdings></font> 首页

toP_= <font face=webdings></font> 上十

toP_= <font face=webdings></font> 上一

toN_= <font face=webdings></font> 下一

toN_= <font face=webdings></font> 下十

toL_=<font face=webdings>:</font> 尾页

============================================

这段代码一定要在VClass_RsOpen 与 for循环之间

Set VClass_Rs = CreateObject(G_FS_RS)

VClass_RsOpen This_Fun_SqlUser_Conn

IF not VClass_Rseof THEN

VClass_RsPageSize=int_RPP

cPageNo=NoSqlHack(RequestQueryString(Page))

If cPageNo= Then cPageNo =

If not isnumeric(cPageNo) Then cPageNo =

cPageNo = Clng(cPageNo)

If cPageNo<= Then cPageNo=

If cPageNo>VClass_RsPageCount Then cPageNo=VClass_RsPageCount

VClass_RsAbsolutePage=cPageNo

FOR int_Start= TO int_RPP

++++++++++

加循环体显示数据

++++++++++

VClass_RsMoveNext

if VClass_Rseof or VClass_Rsbof then exit for

NEXT

END IF

============================================

responseWrite <p>& fPageCount(VClass_Rsint_showNumberLink_str_nonLinkColor_toF_toP_toP_toN_toN_toL_showMorePageGo_Type_cPageNo)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

*********************************************************

目的分页的页面参数保持

提交查询的一致性

输入moveParam分页参数

removeList要移除的参数

返回分页Url

*********************************************************

Function PageUrl(moveParamremoveList)

dim strName

dim KeepUrlKeepFormKeepMove

removeList=removeList&&moveParam

KeepForm=

For Each strName in RequestForm

判断form参数中的submit空值

if not InstrRev(&removeList&&strName& )> and RequestForm(strName)<> then

KeepForm=KeepForm&&&strName&=&ServerURLencode(RequestForm(strName))

end if

removeList=removeList&&strName

Next

KeepUrl=

For Each strName In RequestQueryString

If not (InstrRev(&removeList&&strName& )>) Then

KeepUrl = KeepUrl & & & strName & = & ServerURLencode(RequestQueryString(strName))

End If

Next

KeepMove=KeepForm&KeepUrl

If (KeepMove <> ) Then

KeepMove = Right(KeepMove Len(KeepMove) )

KeepMove = ServerHTMLEncode(KeepMove) & &

End If

PageUrl = replace(RequestServerVariables(URL)/Searchasp/l) & ? & KeepMove & moveParam & =

PageUrl = ? & KeepMove & moveParam & =

End Function

Function fPageCount(Page_RsshowNumberLink_nonLinkColor_toF_toP_toP_toN_toN_toL_showMorePageGo_Type_Page)

Dim This_Func_Get_Html_toPage_p_sp_Itpagecount

Dim NaviLengthStartPageEndPage

This_Func_Get_Html_ = : I =

NaviLength=showNumberLink_

if IsEmpty(showMorePageGo_Type_) then showMorePageGo_Type_ =

tpagecount=Page_Rspagecount

If tPageCount< Then tPageCount=

if not Page_Rseof or not Page_Rsbof then

toPage_ = PageUrl(PagesubmitGetTypenocache_)

if Page= 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 &toPage_& title=首页>&toF_&</a> &vbNewLine

End If

if Page<NaviLength then

StartPage =

else

StartPage = fix(Page / NaviLength) * NaviLength

end if

EndPage=StartPage+NaviLength

If EndPage>tPageCount Then EndPage=tPageCount

If StartPage> Then

This_Func_Get_Html_=This_Func_Get_Html_& <a &toPage_& Page NaviLength & title=&int_showNumberLink_&>&toP_&</a> &vbNewLine

Else

This_Func_Get_Html_=This_Func_Get_Html_& <font color=&nonLinkColor_& title=&int_showNumberLink_&>&toP_&</font> &vbNewLine

End If

If Page <> and Page <> Then

This_Func_Get_Html_=This_Func_Get_Html_& <a &toPage_&(Page)& title=上一页>&toP_&</a> &vbNewLine

Else

This_Func_Get_Html_=This_Func_Get_Html_& <font color=&nonLinkColor_& title=上一页>&toP_&</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 &toPage_&I&> &I& </a> &vbNewLine

End If

If I<>tPageCount Then This_Func_Get_Html_=This_Func_Get_Html_& vbNewLine

Next

If Page <> Page_RsPageCount and Page <> Then

This_Func_Get_Html_=This_Func_Get_Html_& <a &toPage_&(Page+)& title=下一页>&toN_&</a> &vbNewLine

Else

This_Func_Get_Html_=This_Func_Get_Html_& <font color=&nonLinkColor_& title=下一页>&toN_&</font> &vbNewLine

End If

If EndPage<tpagecount Then

This_Func_Get_Html_=This_Func_Get_Html_& <a &toPage_& Page + NaviLength & title=&int_showNumberLink_&>&toN_&</a> &vbNewLine

Else

This_Func_Get_Html_=This_Func_Get_Html_& <font color=&nonLinkColor_& title=&int_showNumberLink_&>&toN_&</font> &vbNewLine

End If

if Page_RsPageCount<>Page then

This_Func_Get_Html_=This_Func_Get_Html_& <a &toPage_&Page_RsPageCount& 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_ = then

Dim Show_Page_i

Show_Page_i = Page +

if Show_Page_i > tPageCount then Show_Page_i =

This_Func_Get_Html_=This_Func_Get_Html_& <input type=text size= maxlength= name=Func_Input_Page onmouseover=thisfocus(); onfocus=thisvalue=&Show_Page_i&; onKeyUp=value=valuereplace(/[^]/g) onbeforepaste=clipboardDatasetData(textclipboardDatagetData(text)replace(/[^]/g))> &vbNewLine _

&<input type=button value=Go onmouseover=Func_Input_Pagefocus(); onclick=javascript:var Js_JumpValue;Js_JumpValue=documentallFunc_Input_Pagevalue;if(Js_JumpValue== !isNaN(Js_JumpValue)) location=&topage_&+Js_JumpValue; else location=&topage_&;> &vbNewLine

Else

This_Func_Get_Html_=This_Func_Get_Html_& 跳转:<select NAME=menu onChange=var Js_JumpValue;Js_JumpValue=thisoptions[thisselectedIndex]value;if(Js_JumpValue!=) location=Js_JumpValue;>

for i= 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:#FF

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_&sp_& &nbsp;每页<b>&Page_RsPageSize&</b>个记录现在是:<b><span class=tx>&sp_&Page&</span>/&tPageCount&</b>页共<b><span id=recordcount>&sp_&Page_RsrecordCount&</span></b>个记录

else

没有记录

end if

fPageCount = This_Func_Get_Html_

End Function

%>

               

上一篇:用aspnet

下一篇:掌握XML实例演练ASP+XML编程