Func_page.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:6k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  2. <%''++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3. ''调用例子
  4. 'Dim int_RPP,int_Start,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo
  5. 'int_RPP=2 '设置每页显示数目
  6. 'int_showNumberLink_=8 '数字导航显示数目
  7. 'showMorePageGo_Type_ = 1 '是下拉菜单还是输入值跳转,当多次调用时只能选1
  8. 'str_nonLinkColor_="#999999" '非热链接颜色
  9. 'toF_="<font face=webdings>9</font>"   '首页 
  10. 'toP10_=" <font face=webdings>7</font>" '上十
  11. 'toP1_=" <font face=webdings>3</font>" '上一
  12. 'toN1_=" <font face=webdings>4</font>" '下一
  13. 'toN10_=" <font face=webdings>8</font>" '下十
  14. 'toL_="<font face=webdings>:</font>" '尾页
  15.  
  16. '============================================
  17. '这段代码一定要在VClass_Rs.Open 与 for循环之间
  18. ' Set VClass_Rs = CreateObject(G_FS_RS)
  19. ' VClass_Rs.Open This_Fun_Sql,User_Conn,1,1
  20. ' IF not VClass_Rs.eof THEN
  21. ' VClass_Rs.PageSize=int_RPP
  22. ' cPageNo=NoSqlHack(Request.QueryString("Page"))
  23. ' If cPageNo="" Then cPageNo = 1
  24. ' If not isnumeric(cPageNo) Then cPageNo = 1
  25. ' cPageNo = Clng(cPageNo)
  26. ' If cPageNo<=0 Then cPageNo=1
  27. ' If cPageNo>VClass_Rs.PageCount Then cPageNo=VClass_Rs.PageCount 
  28. ' VClass_Rs.AbsolutePage=cPageNo
  29. '   FOR int_Start=1 TO int_RPP 
  30.   ''++++++++++
  31.   '加循环体显示数据
  32.   ''++++++++++
  33. ' VClass_Rs.MoveNext
  34. ' if VClass_Rs.eof or VClass_Rs.bof then exit for
  35. '      NEXT
  36. ' END IF   
  37. '============================================
  38. 'response.Write "<p>"&  fPageCount(VClass_Rs,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo)
  39. ''++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  40. Function fPageCount(Page_Rs,showNumberLink_,nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,Page)
  41. Dim This_Func_Get_Html_,toPage_,p_,sp2_,I,tpagecount
  42. Dim NaviLength,StartPage,EndPage
  43. This_Func_Get_Html_ = ""  : I = 1
  44. NaviLength=showNumberLink_ 
  45. if IsEmpty(showMorePageGo_Type_) then showMorePageGo_Type_ = 1
  46. tpagecount=Page_Rs.pagecount
  47. If tPageCount<1 Then tPageCount=1 
  48. if not Page_Rs.eof or not Page_Rs.bof then
  49. if request.ServerVariables("QUERY_STRING")<>"" then 
  50. toPage_ = request.ServerVariables("SCRIPT_NAME")&"?"&request.ServerVariables("QUERY_STRING")
  51. if instr(toPage_,"Page=")>0 then 
  52. toPage_ = mid(toPage_,1,instrrev( toPage_,"Page=" ) + len("Page=") - 1 )
  53. else
  54. toPage_ = toPage_ & "&Page="
  55. end if
  56. else
  57. toPage_ = request.ServerVariables("SCRIPT_NAME")&"?Page="
  58. end if
  59. 'This_Func_Get_Html_=This_Func_Get_Html_& "<form NAME=pageform ID=pageform>"
  60. if Page=1 then 
  61. This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""首页"">"&toF_&"</font> " &vbNewLine
  62. Else 
  63. This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_&"1 title=""首页"">"&toF_&"</a> " &vbNewLine
  64. End If 
  65. if Page<NaviLength then
  66. StartPage = 1
  67. else
  68. StartPage = fix(Page / NaviLength) * NaviLength
  69. end if
  70. EndPage=StartPage+NaviLength-1 
  71. If EndPage>tPageCount Then EndPage=tPageCount 
  72. If StartPage>1 Then 
  73. This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_& Page - NaviLength &" title=""上"&int_showNumberLink_&"页"">"&toP10_&"</a> "  &vbNewLine
  74. Else 
  75. This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""上"&int_showNumberLink_&"页"">"&toP10_&"</font> "  &vbNewLine
  76. End If 
  77. If Page <> 1 and Page <>0 Then 
  78. This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_&(Page-1)&"  title=""上一页"">"&toP1_&"</a> "  &vbNewLine
  79. Else 
  80. This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""上一页"">"&toP1_&"</font> "  &vbNewLine
  81. End If 
  82. For I=StartPage To EndPage 
  83. If I=Page Then 
  84. This_Func_Get_Html_=This_Func_Get_Html_& "<b>"&I&"</b>"  &vbNewLine
  85. Else 
  86. This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_&I&">" &I& "</a>"  &vbNewLine
  87. End If 
  88. If I<>tPageCount Then This_Func_Get_Html_=This_Func_Get_Html_& vbNewLine
  89. Next 
  90. If Page <> Page_Rs.PageCount and Page <>0 Then 
  91. This_Func_Get_Html_=This_Func_Get_Html_& " <a href="&toPage_&(Page+1)&" title=""下一页"">"&toN1_&"</a> "  &vbNewLine
  92. Else 
  93. This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""下一页"">"&toN1_&"</font> "  &vbNewLine
  94. End If 
  95. If EndPage<tpagecount Then  
  96. This_Func_Get_Html_=This_Func_Get_Html_& " <a href="&toPage_& Page + NaviLength &"  title=""下"&int_showNumberLink_&"页"">"&toN10_&"</a> "  &vbNewLine
  97. Else 
  98. This_Func_Get_Html_=This_Func_Get_Html_& " <font color="&nonLinkColor_&"  title=""下"&int_showNumberLink_&"页"">"&toN10_&"</font> "  &vbNewLine
  99. End If 
  100. if Page_Rs.PageCount<>Page then  
  101. This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_&Page_Rs.PageCount&" title=""尾页"">"&toL_&"</a>"  &vbNewLine
  102. Else 
  103. This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""尾页"">"&toL_&"</font>"  &vbNewLine
  104. End If 
  105. If showMorePageGo_Type_ = 1 then 
  106. This_Func_Get_Html_=This_Func_Get_Html_& "<input type=""text"" size=""4"" name=""Func_Input_Page"" value="""&Page+1&""">" &vbNewLine _
  107. &"<input type=""button"" value=""Go"" onclick=""javascript:var Js_JumpValue;Js_JumpValue=document.all.Func_Input_Page.value;if(! isNaN(Js_JumpValue)) location='"&topage_&"'+Js_JumpValue; else alert('1、输入的页面必须是数字“Js_JumpValue='+Js_JumpValue+'”n2、当程序多次调用分页函数时不能用该模式');"">"  &vbNewLine
  108. Else
  109. This_Func_Get_Html_=This_Func_Get_Html_& " 跳转:<select NAME=menu1 onChange=""var Js_JumpValue;Js_JumpValue=this.options[this.selectedIndex].value;if(Js_JumpValue!='') location=Js_JumpValue;"">"
  110. for i=1 to tPageCount
  111. This_Func_Get_Html_=This_Func_Get_Html_& "<option value="&topage_&i
  112. if Page=i then This_Func_Get_Html_=This_Func_Get_Html_& " selected style='color:#0000FF'"
  113. This_Func_Get_Html_=This_Func_Get_Html_& ">第"&cstr(i)&"页</option>" &vbNewLine
  114. next
  115. This_Func_Get_Html_=This_Func_Get_Html_& "</select>" &vbNewLine
  116. End if
  117. This_Func_Get_Html_=This_Func_Get_Html_& p_&sp2_&" "&Page_Rs.PageSize&"项 "&sp2_&Page&"/"&tPageCount&"页 "&sp2_&Page_Rs.recordCount&"项"
  118. 'This_Func_Get_Html_=This_Func_Get_Html_& "</form>" 
  119. else
  120. '没有记录
  121. end if
  122. fPageCount = This_Func_Get_Html_
  123. End Function
  124. %>