<%+++++++++++++++++++++++++++++++++++++++++++++++++++++++
調用例子
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_& 每頁<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
%>
From:http://tw.wingwit.com/Article/program/net/201311/13668.html