• ----:)欢迎访问源码网(:----
    • 首页
    • 博客
    • 学院
    • 下载
    • 论坛
    • 影视
    • 发布源码
    • RSS
    • ITPig
    • 笑话网
    • 百家姓
    • 繁體中文

源码网 - 中国第一源码门户
选择镜像:网通镜像 - 电信主站
  • 首 页
  • 新闻动态
  • 网站运营
  • 网页制作
  • WEB开发
  • 编程开发
  • 图像媒体
  • 操作系统
  • 数据库
  • 服务器
热门搜索 优化 SEO 故事 cms IIS7 MySQL 个人 AdSense 主题推广 | 文章搜索: 高级搜索
会员登录/控制面版您的位置: 学院首页 >> WEB开发 >> ASP开发 >> ASP应用 >> 详细内容
 

推荐文章

 
 

热点文章

  • ASP计算汉字笔画程序代码
  • 身份证查询的ASP版Ajax服务器端,不需要数据库支持
  • ASP入门教程(留言板)
  • ASP小偷程序的原理
  • 用文本+ASP打造新闻发布系统/图片上传
  • 超级留言本制作实例
  • ASP实现的日历,可以根据需要在日期上添加任何的操作
  • 利用ADODB.Stream使用浏览器下载服务器文件
  • Asp深度揭密
  • t0nsha's留言板代码
  • 无组件上传图片到数据库中,最完整解决方案
  • ASP操作Excel技术总结
 
 

相关文章

  • 国内ASP应用,不容乐观
  • 用ASP创建多栏选项列表
  • 用户状态维护
  • ASP3.0中的流控制能力
  • session的几个问题
  • 编写ASP时用JScript好还是用VBScript好?
  • 域名登记查询(whois)很复杂吗
  • LINE9的目录浏览源程序
  • 谈谈对于ASP+ PDC bits的经验
  • 浅析数据完整性问题
  • 下载文件的代码
  • 不用Golobal.asa和session实现在线人数统计
 
 

百度搜索

 
 

分页显示的例子(显示记录背景色替换变化)

  • 阅览次数:
  • 文章来源: 网海之贝
  • 原文作者: 佚名
  • 整理日期: 2006-10-03
  • 发表评论
  • 字体大小:
  • 小
  • 中
  • 大

Code Title: Paging (modifiable)
Description: Add paging to your record retrieval. But, do it with the good'ol form field that allows you
to just type in directly what page ya wanna go to. This one is our fave! It even alternates the background
color (bgcolor) of each row, to make viewing the recordset even easier.. We use different tweaked versions
of this one all over our site! See an example of this code snippet on our International page.

We have made it so that it will display a hyperlinked first item in one column, then a truncated
description using the Left() function in the next column. The hyperlink will take you to the specific
article or record, (whatever you're using it for).

We use a javascript valid number checker on this one, just to make sure the person doesn't enter any weird
characters into the page number field of the form. We don't normally do this, but if ya want the
javascript for number checking, check out our jsNumberValidator.
Copy and paste this snippet as-is into your editor:


<%
Const adUseClient = 3
Const adOpenStatic = 3
specific = Request.QueryString("specific")
If specific = "" Then
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.CursorLocation = adUseClient
rs.CacheSize = 5
mypage = Request.Form("pgNum")
If  mypage = "" Then mypage = 1
rs.Open "SELECT * FROM TABLE ORDER BY FIELD ASC", cnDZ, adOpenStatic
If Not rs.EOF Then
  rs.MoveFirst
  rs.PageSize = 20 'change this number to exactly how many records per page ya wanna show
  maxcount = cint(rs.PageCount)
  rs.AbsolutePage = mypage
  howmanyrecs = 0
  Response.Write"<table border=0>"
  LinkCount = 0
  While Not rs.EOF And howmanyrecs < rs.pagesize
  If LinkCount Mod 2 = 0 Then bgColor = " bgcolor=#F0F0F0" Else bgColor = ""
  Response.Write"<tr"&bgColor&"><td nowrap>"&_
   "<a href=""myPage.asp?specific="&rs("ID")&""">"&rs("FIELD")&"</a></td>"&_
   "<td width=""100%"" nowrap>"&Left(rs("FIELD2"),40)&"</td></tr>"
  LinkCount = LinkCount + 1
  rs.MoveNext
  howmanyrecs = howmanyrecs + 1
  Wend
  Response.Write"</table>"
  If maxcount > 1 Then
   If mypage + 1 > maxcount Then nextPg = 1 Else nextPg = mypage + 1
   Response.Write"<form method=post action=""myPage.asp"">"&_
    "<nobr>Page "&mypage&" of "&maxcount&"      Navigate to Page:<input
type=text name=pgNum size=3 maxlength=3 value="""&nextPg&""">  <input type=submit name=gopgNum
value=GO></nobr></form>"
  End If
Else Response.Write"Sorry, nothing is available at the moment."
End If
rs.Close
Set rs = Nothing
Else
Set rs = cnDZ.Execute("SELECT * FROM TABLE WHERE ID = "&specific&"")
Do Until rs.EOF
Response.Write""&rs("FIELD")&"<br>"&_
  ""&rs("FIELD2")&"<br>"
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End If
%>


       

上一篇:Asp深度揭密
下一篇:构建支持Master/Slave读写分离的数据库操作类
  • 网友评论:
  • 查看所有评论
  • 我要发表评论
您的网名:
留言主题:
你要发表的内容:

 

关于本站 | 广告联系 | 版权声明 | 网站地图 | 发布软件 | 帮助中心 | 源码论坛

Copyright © 2005-2007 CodePub.Com  程序支持:木翼  滇ICP备05005971号