日期:2009-07-15  浏览次数:20738 次

 

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
' ************************************************************************


' Script Compont Object Model
' Design for Active Server Pages
'
' Copyright 2004  Version 2.0
' Made by 尹曙光
' ************************************************************************
function CreateCPageNavbar()
  set CreateCPageNavbar=new CPageNavbar
end function
Class  CPageNavbar
   Public SplitSize '分页显示的容量
   public PnWidth
   public PnAlign
   public PlWidth  '表格宽度
   public PlAlign  ' 表格的对齐方式
   private PageSize
   private RecordCount  '总记录数]
   private PageCount   '总页数
   private CurrentPage  '当前的页码
   private SplitCount '分页的显示的总页数
   private CurrentSplit '当前的分页的分页码
  '===============================================================
  Private Sub Class_Initialize   ' Setup Initialize event.
          SplitSize=10
          PnWidth="100%"
          PnAlign="right"
          PlWidth="100%"  //表格宽度
          PlAlign="right"  // 表格的对齐方式
    PageSize=0
          RecordCount=0
          CurrentPage=1
    PageCount=1
    SplitCount=1
    CurrentSplit=1
   End Sub
   Private Sub Class_Terminate   ' Setup Terminate event.
   End Sub
 
   public sub InitPageNavbar(byval iPageSize,byval iRecordCount)
         PageSize=cint(iPageSize)
         RecordCount=clng(iRecordCount)
   PageCount=fix(RecordCount/PageSize)+1
   SplitCount=fix(PageCount/SplitSize)+1
   end sub
public function GetCurrentPage()
          'on error resume next
          dim pageNo
       pageNo =trim(Request.QueryString ("_Page_No_"))
          '如果没有选择第几页,则默认显示第一页;
          if ( (not IsNumeric(pageNo)) or pageNo="")  then
             pageNo =1
          end if
    CurrentPage=clng(pageNo)
    if (CurrentPage<1) then
             CurrentPage=1
    end if 
    if (CurrentPage>PageCount) then
             CurrentPage=PageCount
    end if 
    CurrentSplit=fix(CurrentPage/SplitSize)+1
          GetCurrentPage=CurrentPage
   end function

   public  function plDisplay()
       dim strBuilder,p,itmp
       strBuilder=""
      '首组为第0族
      strBuilder=strBuilder+"<table border='0' cellpadding='0' cellspacing='0' "
      strBuilder=strBuilder+" width='"