'========================
If Request("currentpage")="" Then
int_curpage=1
ElseIf not(IsNumeric(Request("currentpage"))) Then
int_curpage=1
ElseIf CInt(Trim(Request("currentpage")))<1 Then
int_curpage=1
Else
Int_curpage=CInt(Trim(Request("currentpage")))
End If
End Sub
'=============================================
'ShowPage 创建分页导航条
'有首页、前一页、下一页、末页、还有数字导航
'
'=============================================
Public Sub ShowPage()
Dim str_tmp
XD_sURL = GetUrl()
' int_totalRecord=XD_Rs.RecordCount
If int_totalRecord<=0 Then
str_error=str_error & "总记录数为零,请输入数据"
Call ShowError()
End If
If int_totalRecord="" then
int_TotalPage=1
Else
'modify by wls 041215 For the right pages display---------------
If int_totalRecord mod PageSize =0 Then
int_TotalPage = CLng(int_TotalRecord \ XD_PageSize * -1)*-1
Else
int_TotalPage = CLng(int_TotalRecord \ XD_PageSize * -1)*-1 1
End If
End If
If Int_curpage>int_Totalpage Then
int_curpage=int_TotalPage
End If
'========================================================
'显示分页信息,各个模块根据自己要求更改显求位置
'========================================================
'response.write " "
str_tmp=ShowFirstPrv
response.write str_tmp
str_tmp=showNumBtn
response.write str_tmp
str_tmp=ShowNextLast
response.write str_tmp
str_tmp=ShowPageInfo
response.write str_tmp
Response.write " "
ShowGoto
End Sub
'=============================================
'ShowFirstPrv 显示首页、前一页
'
'
'=============================================
Private Function ShowFirstPrv()
Dim Str_tmp,int_prvpage
If int_curpage=1 Then
str_tmp=Btn_First&" "&Btn_Prev
Elseif int_curpage=0 then
str_tmp=Btn_First&" "&Btn_Prev
else
int_prvpage=int_curpage-1
str_tmp="<a href=""#"" onclick=""javascript:generalSubmit('1')"" alt=""第一页"">" & Btn_First&"</a> <a href=""#"" onclick=""javascript:generalSubmit('"&int_prvpage&"')"" alt=""前一页"">" & Btn_Prev&"</a>"
End If
ShowFirstPrv=str_tmp
End Function
'=============================================
'ShowNextLast 下一页、末页
'
'
'=============================================
Private Function ShowNextLast()
Dim str_tmp,int_Nextpage
If Int_curpage>=int_totalpage Then
str_tmp=Btn_Next & " " & Btn_Last
Else
Int_NextPage=int_curpage 1
str_tmp="<a href=""#"" onclick=""javascript:generalSubmit('"&int_nextpage&"')"" alt=""后一页"">" & Btn_Next&"</a> <a href=""#"" onclick=""javascript:generalSubmit('"&int_totalpage&"')"" alt=""最后一页"">" & Btn_Last&"</a>"
End If
ShowNextLast=str_tmp
End Function
'End Function
'=============================================
'ShowNumBtn 修改后的数字导航
'
'=============================================
Function showNumBtn()
Dim i,str_tmp,end_page,start_page
start_page=1
'add by sll 2005.05.20 int_curpage=0
if int_curpage=0 then
str_tmp=str_tmp&"0"
else
if int_curpage>1 then
start_page=int_curpage
if (int_curpage<=5) then
start_page=1
end if
if (int_curpage>5) then
start_page=int_curpage-2
end if
end if
end_page=start_page 5
if end_page>int_totalpage then
end_page=int_totalpage
end if
For i=start_page to end_page
strTemp=XD_sURL & CStr(i)
str_tmp=str_tmp & "[<a href=""#"" onclick=""javascript:generalSubmit('"&i&"')"">"&i&"</a>] "
Next
end if
showNumBtn=str_tmp
End Function
'=============================================
'ShowGoto 页面跳转
'页面自动跳转
'add by sll 2005.05.20
'=============================================
Private Function ShowGoto()
'response.write int_totalPage
dim inti
if int_totalPage<=0 then
response.write "<select name='goto' disabled>"
Response.Write "<option value='0'>0</option>"
response.write "</select>"
else
response.write "<select name='goto' onchange='javascript:generalSubmit(this.value)'>"
for inti=1 to int_totalPage
Response.Write "<option value='"&inti&"'"
if cstr(inti)=cstr(int_curpage) then
response.write "selected"
end if
response.write" >"&inti&"</option>"
next
response.write "</select>"
end if
End Function
'=============================================
'ShowPageInfo 分页信息
'根据要求自行修改
'
'=============================================
Private Function ShowPageInfo()
Dim str_tmp
str_tmp=" [页次:<font color=red>"&int_curpage&"</font>/"&int_totalpage&"页] [共"&int_totalrecord&"条] ["&XD_PageSize&"条/页]"
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!



