当前位置:编程学习 > asp >>

asp+oracle分页程序类(XDOWNPAGE2.0)(2)

答案:     public sub GetSubmitForm1()
   '页导航的javascript函数
   Response.Write " "+vrcrlf
   Response.Write ("<Script language=""javascript"">") +vbcrlf
   Response.Write " function generalSubmit(i)"+vbcrlf
   Response.Write " {"+vbcrlf
   Response.Write " document."&SubmitForm&".flag.value=""query1111111155555"";"+vbcrlf
   Response.Write " document."&SubmitForm&".currentpage.value=i;"+vbcrlf
   Response.Write " "&SubmitForm&".submit();"+vbcrlf
  
   Response.Write " }"+vbcrlf
  
   '改变页大小的javascript函数
   Response.Write " function changePageSize(ii)"+vbcrlf
   Response.Write " {"+vbcrlf
   Response.Write " document."&SubmitForm&".flag.value=""query1111111155555"";"+vbcrlf
   Response.Write " document."&SubmitForm&".currentpage.value=1;"+vbcrlf
   Response.Write " document."&SubmitForm&".pagesize.value=ii;"+vbcrlf
   Response.Write " "&SubmitForm&".submit();"+vbcrlf
  
   Response.Write " }"+vbcrlf
   Response.Write ("</Script>")+vbcrlf
   Response.Write " "+vrcrlf
  end sub
  
  '==================================================================
  'totalRecordCount 属性
  '关于记录总数
  '
  '==================================================================
  
  Public Property Let totalRecordCount(int_totalRecordCount)
   If IsNumeric(int_totalRecordCount) Then
   int_totalRecord=CLng(int_totalRecordCount)
   End If
  End Property
  
  Public Property Get totalRecordCount
   If not(int_totalRecord="" or (not(IsNumeric(int_totalRecord)))) Then
   totalRecordCount=int_totalRecord
   End If
  End Property
  '==================================================================
  'GetRecordCount 方法
  '返回当前记录数
  '
  '==================================================================
  public function GetRecordCount()
   GetRecordCount=int_totalRecord
  end function
  '==================================================================
  'Class_Initialize 类的初始化
  '初始化当前页的值
  '
  '==================================================================
  Private Sub Class_Initialize
   '========================
   '设定一些参数的黙认值
   '========================
  ' XD_PageSize=10 '设定分页的默认值为10
   '========================
   '获取当前面的值
   '========================
   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=>" & Btn_First&"</a> <a href=>" & 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=>" & Btn_Next&"</a> <a href=>" & 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
&nb

上一个:ASP编程实现网络内容快速查找
下一个:asp+oracle分页程序类(XDOWNPAGE2.0)(1)

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,