首页学院源码字体下载软件电脑书| 素材图片模版壁纸酷站图标笔刷纹理|小游戏博客QQ表情投票计数器JoyRssMail
动态网站制作指南
首页|网络编程|站长之家|网页制作|图形图象|操作系统|冲浪宝典|软件教学|网络办公|手机学院|邮件系统|网络安全|认证考试
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket

asp中可以保存参数值的分页代码


发表日期:2007-1-11 |


<%''+++++++++++++++++++++++++++++++++++++++++++++++++++++++
''调用例子
'Dim int_RPP,int_Start,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo
'int_RPP=2 '设置每页显示数目
'int_showNumberLink_=8 '数字导航显示数目
'showMorePageGo_Type_ = 1 '是下拉菜单还是输入值跳转,当多次调用时只能选1
'str_nonLinkColor_="#999999" '非热链接颜色
'toF_="<font face=webdings>9</font>"     '首页
'toP10_=" <font face=webdings>7</font>"   '上十
'toP1_=" <font face=webdings>3</font>"   '上一
'toN1_=" <font face=webdings>4</font>"   '下一
'toN10_=" <font face=webdings>8</font>"   '下十
'toL_="<font face=webdings>:</font>"    '尾页

'============================================
'这段代码一定要在VClass_Rs.Open 与 for循环之间
' Set VClass_Rs = CreateObject(G_FS_RS)
' VClass_Rs.Open This_Fun_Sql,User_Conn,1,1
' IF not VClass_Rs.eof THEN
' VClass_Rs.PageSize=int_RPP
' cPageNo=NoSqlHack(Request.QueryString("Page"))
' If cPageNo="" Then cPageNo = 1
' If not isnumeric(cPageNo) Then cPageNo = 1
' cPageNo = Clng(cPageNo)
' If cPageNo<=0 Then cPageNo=1
' If cPageNo>VClass_Rs.PageCount Then cPageNo=VClass_Rs.PageCount
' VClass_Rs.AbsolutePage=cPageNo
'   FOR int_Start=1 TO int_RPP
   ''++++++++++
   '加循环体显示数据
   ''++++++++++
'  VClass_Rs.MoveNext
'  if VClass_Rs.eof or VClass_Rs.bof then exit for
'      NEXT
' END IF  
'============================================
'response.Write "<p>"&  fPageCount(VClass_Rs,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo)

''++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'*********************************************************
' 目的:分页的页面参数保持
'          提交查询的一致性
' 输入:moveParam:分页参数
'         removeList:要移除的参数
' 返回:分页Url
'*********************************************************
Function PageUrl(moveParam,removeList)
 dim strName
 dim KeepUrl,KeepForm,KeepMove
 removeList=removeList&","&moveParam
 KeepForm=""
 For Each strName in Request.Form
  '判断form参数中的submit、空值
  if not InstrRev(","&removeList&",",","&strName&",", -1, 1)>0 and Request.Form(strName)<>"" then
   KeepForm=KeepForm&"&"&strName&"="&Server.URLencode(Request.Form(strName))
  end if
  removeList=removeList&","&strName
 Next
 
 KeepUrl=""
 For Each strName In Request.QueryString
  If not (InstrRev(","&removeList&",",","&strName&",", -1, 1)>0) Then
   KeepUrl = KeepUrl & "&" & strName & "=" & Server.URLencode(Request.QueryString(strName))
  End If
 Next
 
 KeepMove=KeepForm&KeepUrl
 
 If (KeepMove <> "") Then
   KeepMove = Right(KeepMove, Len(KeepMove) - 1)
   KeepMove = Server.HTMLEncode(KeepMove) & "&"
 End If
 
 'PageUrl = replace(Request.ServerVariables("URL"),"/Search.asp","/Search.html") & "?" & KeepMove & moveParam & "="
 PageUrl =  "?" & KeepMove & moveParam & "="
End Function


Function fPageCount(Page_Rs,showNumberLink_,nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,Page)

Dim This_Func_Get_Html_,toPage_,p_,sp2_,I,tpagecount
Dim NaviLength,StartPage,EndPage

This_Func_Get_Html_ = ""  : I = 1  
NaviLength=showNumberLink_

if IsEmpty(showMorePageGo_Type_) then showMorePageGo_Type_ = 1
tpagecount=Page_Rs.pagecount
If tPageCount<1 Then tPageCount=1

if not Page_Rs.eof or not Page_Rs.bof then

toPage_ = PageUrl("Page","submit,GetType,no-cache,_")

if Page=1 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 href="&toPage_&"1 title=""首页"">"&toF_&"</a> " &vbNewLine
End If
if Page<NaviLength then
 StartPage = 1
else
 StartPage = fix(Page / NaviLength) * NaviLength
end if
EndPage=StartPage+NaviLength-1
If EndPage>tPageCount Then EndPage=tPageCount

If StartPage>1 Then
 This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_& Page - NaviLength &" title=""上"&int_showNumberLink_&"页"">"&toP10_&"</a> "  &vbNewLine
Else
 This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""上"&int_showNumberLink_&"页"">"&toP10_&"</font> "  &vbNewLine
End If

If Page <> 1 and Page <>0 Then
 This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_&(Page-1)&"  title=""上一页"">"&toP1_&"</a> "  &vbNewLine
Else
 This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""上一页"">"&toP1_&"</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 href="&toPage_&I&">" &I& "</a>"  &vbNewLine
 End If
 If I<>tPageCount Then This_Func_Get_Html_=This_Func_Get_Html_& vbNewLine
Next

If Page <> Page_Rs.PageCount and Page <>0 Then
 This_Func_Get_Html_=This_Func_Get_Html_& " <a href="&toPage_&(Page+1)&" title=""下一页"">"&toN1_&"</a> "  &vbNewLine
Else
 This_Func_Get_Html_=This_Func_Get_Html_& "<font color="&nonLinkColor_&" title=""下一页"">"&toN1_&"</font> "  &vbNewLine
End If

If EndPage<tpagecount Then 
 This_Func_Get_Html_=This_Func_Get_Html_& " <a href="&toPage_& Page + NaviLength &"  title=""下"&int_showNumberLink_&"页"">"&toN10_&"</a> "  &vbNewLine
Else
 This_Func_Get_Html_=This_Func_Get_Html_& " <font color="&nonLinkColor_&"  title=""下"&int_showNumberLink_&"页"">"&toN10_&"</font> "  &vbNewLine
End If

if Page_Rs.PageCount<>Page then 
 This_Func_Get_Html_=This_Func_Get_Html_& "<a href="&toPage_&Page_Rs.PageCount&" 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_ = 1 then
 Dim Show_Page_i
 Show_Page_i = Page + 1
 if Show_Page_i > tPageCount then Show_Page_i = 1
 This_Func_Get_Html_=This_Func_Get_Html_& "<input type=""text"" size=""4"" maxlength=""10"" name=""Func_Input_Page"" onmouseover=""this.focus();"" onfocus=""this.value='"&Show_Page_i&"';"" onKeyUp=""value=value.replace(/[^1-9]/g,'')"" onbeforepaste=""clipboardData.setData('text',clipboardData.getData('text').replace(/[^1-9]/g,''))"">" &vbNewLine _
  &"<input type=""button"" value=""Go"" onmouseover=""Func_Input_Page.focus();"" onclick=""javascript:var Js_JumpValue;Js_JumpValue=document.all.Func_Input_Page.value;if(Js_JumpValue=='' || !isNaN(Js_JumpValue)) location='"&topage_&"'+Js_JumpValue; else location='"&topage_&"1';"">"  &vbNewLine

Else

 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;"">"
 for i=1 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:#0000FF'"
  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_&sp2_&" &nbsp;每页<b>"&Page_Rs.PageSize&"</b>个记录,现在是:<b><span class=""tx"">"&sp2_&Page&"</span>/"&tPageCount&"</b>页,共<b><span id='recordcount'>"&sp2_&Page_Rs.recordCount&"</span></b>个记录。"

else
 '没有记录
end if
fPageCount = This_Func_Get_Html_
End Function
%>
http://blog.csdn.net/hzf100/archive/2006/12/28/1465471.aspx

关注此文的读者还看过:
·不能ASP图像组件来生成图像的ASP计数器程序(三) 
·使用速度更快的OLEDB取代ODBC连结
·一些常用的正则表达式大全
·如何增强ASP程序性能(2)
·排序方式解决“上下主题”问题(二)
·ASP日期和时间函数示例
·在ASP处理程序时显示进度
·在 Web 页上使用条件数值格式
·实践xml缓存技术构建高性能web站点
·asp+中是如何连接数据库ado+的

浏览全部asp的内容 PS笔刷下载 39种不同语言在线翻译
文章搜索服务





邮件订阅服务
输入你的邮件地址,你将不会错过任何关于<ASP技巧>的内容
Powered by JoyRssMail

网络编程文章分类

本月文章推荐
. PerlScript编写ASP.
. ASP出错集成处理.
. 如何判断conn.Execute成功 或失败?.
. vbscript和javascript互相调用.
. 学会在ASP中使用存储过程.
. ASP伪静态页简单.
. 如何从ACCESS数据库中读取图形(续).
. 关于在浏览器中执行*.exe文件的深入.
. 在ASP中通过oo4o连接Oracle数据库的.
. 使用ASP加密算法加密你的数据(二).
. 用ASP实现网页保密的两种方法.
. 如何在pb中创建COM组件,并在asp中.
. ASP提速技巧五则.
. 实用函数- 判断输入的是否是电话号.
. 关于ACCESS 2K与ASP的几点想法.
. 关于释放session的两篇文章(二).
. 随机访问Recordset的一条记录.
. 几个常用的ASP自定义函数.
. 实现聊天室在线人员无刷新所需要的.
. 用ASP方式实现动态伸缩形式列表主页.
. asp连接数据库的方法(全).
. 用IE和SQL2k开发一个XML聊天程序.
. 防止重复提交的巧妙方法.
. ASP时间函数.
. 实现聊天室在线人员无刷新所需要的.
. 提高IIS的安全性.
. 如何用ASP建立图表.
. 利用 WSH 作定时工作流程.
. ASP数据库编程SQL常用技巧.
. 网络开发之编程技巧之一(有效验证用.
  最新网站源码 最新软件下载
2009-7-4 84网址站 v4.10
2009-7-4 仿webmasterhome 网站收录查询 v
2009-7-4 NOCC v1.8
2009-7-4 易和阳光购物商城 v1.4 Access F
2009-7-4 OK伯乐招聘求职系统
2009-7-3 MyBB v1.4.8
2009-7-3 miniBB v2.3
2009-7-3 Modoer多功能点评系统 v1.1.0 Bu
2009-7-3 Modoer多功能点评系统 v1.1.0 Bu
2009-4-4 SharePoint Designer 2007
2009-3-20 Internet Explorer 8 简体中文正
2009-3-20 Internet Explorer 8 简体中文正
2009-3-20 Internet Explorer 8 简体中文正
2009-3-20 Internet Explorer 8 简体中文正
2009-3-20 Internet Explorer 8 简体中文正
2009-3-20 Internet Explorer 8 简体中文正
2009-3-20 Internet Explorer 8 简体中文正
2009-3-20 Internet Explorer 8 简体中文正
  发表评论
姓 名: 验证码: [ 查看评论 ]
内 容:
 
站长工具:Google PR查询|网站速度测试|CSS在线编辑器|OPEN参数生成器|弹出式窗口代码产生器|密码登录生成器|在线按钮生成器|Meta标签生成器|邮箱图标在线生成|多色彩特效字代码生成器|网页代码调试器|在线FTP登陆|Flash取色器|配色代码对照表|配色辞典|CSS生成器|CSS在线压缩|广告代码|框架网页代码生成器|js/vbs加密|md5加密|进制转换|UTF-8 转换工具|在线调色板|Html转换js|Html转换asp|Html转换php|Html转换perl
实用工具:汉字翻译拼音|拼音字典|在线翻译|天气预报|火星文|在线网速测试|符号对照表|个税计算|公积金贷款计算|购房银行按揭利率计算|实时汇率查询换算|经典小工具|汉字简繁转换|普通单位换算|公制单位换算|生辰老黄历|国内电话区号|国家代码与域名缩写|文字加密解密|元素周期表|健康查询|世界时间|全国各地车牌查询|全国车辆交通违章查询|万年历|二十四节气|汉字横竖排版|手机号码查询|计算器|ip搜索
广告刊登 | 版权声明 | 联系我们 | 加入收藏 | RSS订阅
Copyright © 2000-2009 www.knowsky.com All rights reserved | 沪ICP备05001343号