The ASP program realizes the paging function of saving parameter value

Source: Internet
Author: User
Tags prev urlencode

The following are the referenced contents:
<% ' +++++++++++++++++++++++++++++++++++++++++++++++++++++++
"Call Example
' Dim Int_rpp,int_start,int_shownumberlink_,str_nonlinkcolor_,tof_,top10_,top1_,ton1_,ton10_,tol_,showmorepagego _type_,cpageno
' int_rpp=2 ' Sets the number of display per page
Number of ' int_shownumberlink_=8 ' digital navigation display
' Showmorepagego_type_ = 1 ' is a drop-down menu or an input value jump, which can only be selected when multiple calls 1
' str_nonlinkcolor_= ' #999999 ' non-hot link color
' tof_= ' <font face=webdings>9</font> ' home
' top10_= ' <font face=webdings>7</font> ' 10
' top1_= ' <font face=webdings>3</font> ' on a
' ton1_= ' <font face=webdings>4</font> ' the next
' ton10_= ' <font face=webdings>8</font> ' the next ten
' tol_= ' <font face=webdings>:</font> ' last

'============================================
' This code must be between the Vclass_rs.open and the For loop
' 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
''++++++++++
' Add loop body display data
''++++++++++
' 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)

''++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'*********************************************************
' Purpose: Paging page parameters are maintained
' Submit Query consistency
' Input: Moveparam: Paging parameters
' Removelist: The parameter to be removed
' Return: Pagination URL
'*********************************************************
Function Pageurl (moveparam,removelist)
Dim strName
Dim keepurl,keepform,keepmove
removelist=removelist& "," &moveparam
Keepform= ""
For each strName in Request.Form
' Judge the submit, null value in the form parameter
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= "" Home "" > "&toF_&" </font> "&vbnewline
Else
 this_func_get_html_=this_func_ get_html_& "<a href=" &toPage_& "1 title=" "Home" ">" &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=" "On" & int_shownumberlink_& "page" ">" &toP10_& "</a>" &vbnewline
Else
this_func_get_html_=this_func_get_html_& "<font color=" &nonLinkColor_& "title=" "On" &int_ shownumberlink_& "page" ">" &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=" "prev" ">" & top1_& "</a>" &vbnewline
Else
this_func_get_html_=this_func_get_html_& "<font color=" &nonLinkColor_& "title=" "prev" ">" & 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=" "Next" ">" & ton1_& "</a>" &vbnewline
Else
this_func_get_html_=this_func_get_html_& "<font color=" &nonLinkColor_& "title=" "Next" ">" & ton1_& "</font>" &vbnewline
End If

If Endpage<tpagecount Then
this_func_get_html_=this_func_get_html_& "<a href=" &toPage_& Page + navilength & "title=" "Down" & int_shownumberlink_& "page" ">" &toN10_& "</a>" &vbnewline
Else
this_func_get_html_=this_func_get_html_& "<font color=" &nonLinkColor_& "title=" "Down" &int_ shownumberlink_& "page" ">" &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=" "Last" > "&toL_&" </a> "&vbnewline
Else
this_func_get_html_=this_func_get_html_& "<font color=" &nonLinkColor_& "title=" "Last" ">" &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=" "Ten" "Name=" "Func_Input" _page "" Onmouseover= "" This.focus (); "onfocus=" "this.value=" "&Show_Page_i&" "onkeyup=" " 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_& "Jump: <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) & "page </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_& "Every page <b>" &Page_Rs.PageSize& "</b> Records, now: <b><span class= "TX" ">" &sp2_&Page& "</span>/" &tPageCount& </b > page, a total of <b><span id= ' RecordCount ' > ' &sp2_&Page_Rs.recordCount& ' </span></b> records. "

Else
' No record
End If
Fpagecount = This_func_get_html_
End Function
%>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.