快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

分页的显示-->前后翻滚10页的实现

<%
set con=server.CreateObject("ADODB.Connection")
strConnection="Data Source=xxxxxxx;"
con.Open strConnection

set rs = Server.CreateObject("ADODB.Recordset")
chartSQL="select ID,name,category_one from goods "
rs.Open chartSQL,con,1,3
if rs.EOF or rs.BOF then \\'假如为空
response.end
end if
pagesize=10 \\'每页显示10条记录
pagecuont=rs.PageCount \\'总页数
recordcount=rs.RecordCount
dim pagenum \\'当前页码
dim currentRecord \\'当前页的记录数,对于末页其值不等于pagesize
if Request.QueryString ("pageNum")="" then
pageNum=1
else
pageNum=Request.QueryString ("pageNum")
rs.AbsolutePage =trim(Request.QueryString ("pageNum"))
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<SCRIPT LANGUAGE=javascript>
<!--
function openwindow(url){
window.open(url,\\'\\',\\'resizable=no,width=240,height=160,fullscreen=yes\\')
}
//-->
</SCRIPT>
<link rel="stylesheet" href="file:///F|/mysourceof17560/CSS.CSS" type="text/css">
</head>
<body bgcolor=#999999>
<p align="center">商品修改页面</p>
<table border="1" width="100%" cellpadding="0" cellspacing="0" bordercolordark="#999999" bordercolorlight="#000000">
<tr>
<td width="10%">
<div align="center">编号 </div>
</td>
<td width="63%">
<div align="center">商品名 </div>
</td>
<td width="14%"> 
<div align="center">主分类</div>
</td>
<td width="13%">
<div align="center">操作 </div>
</td>
</tr>
<%
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then \\'本条件判定是否到了尽头
exit for
end if
%>
<tr>
<td width="10%" align=center><%=rs("ID")%></td>
<td width="63%" align=center><%=rs("name")%> </td>
<td width="14%" align=center><%=rs("category_one")%> </td>
<td width="13%">
<div align="center">
<INPUT type="button" value="Button" id=button1 name=button1
onclick="javascript:window.open(\\'tomodify.asp?id=<%=rs("ID")%>&zfenlei=<%=rs("category_one")%>\\',\\'\\',\\'resizable=no,width=240,height=160\\')">
 </div>
</td>
</tr>
<%
currentRecord=currentRecord+1 \\'取的当前页的记录数
rs.MoveNext
next
rs.Close
%>
</table>
<div align="center" class="bfont">合计<%=recordCount%> 条记录 | 第
<%
pageNum_record=(pageNum-1)*pageSize+1 \\'初始记录位置
pageNum_record_=pageNum_record+currentRecord-1 \\'末记录位置
Response.Write pageNum_record
%>
-<%=pageNum_record_%>条 | 第<%=pageNum%>页 |共<%=pagecuont%>页
<%
if pagecuont >0 then \\'防止当前返回的为空记录,即数据库中该数据集为空
if pageNum > 1 then %>
<a href="modifychart.asp?pageNum=1"> <font color="#FFFFFF">首页</font></a>
<%
else Response.Write "首页"
end if
if pageNum > 10 then
\\'如有需要,请在这里添上假如不足10页时该实现前n页的代码,
\\'请参考下面的假如后面不足10页时该怎么样处理的代码和思路
%>
<a href="modifychart.asp?pageNum=<%=(pageNum-10)%>"> <font color="#FFFFFF">前10页</font></a>
<%
end if
if (pageNum+10) < pagecuont then
\\'这里也一样参考下面的思路
%>
<a href="modifychart.asp?pageNum=<%=(pageNum+10)%>"> <font color="#FFFFFF">下10页</font></a>
<%
end if
if (pageNum+10) < pagecuont then
\\'这里判定后面是否还有10页
endpage=pageNum+9
else
endpage=pageCount
end if
for i=pageNum to endPage
%>
<a href="modifychart.asp?pageNum=<%=i%>">第<%=i%>页</a>
<%
next
if pageNum <> pageCount then
%>
<a href="modifychart.asp?pageNum=<%=pagecuont%>"> <font color="#FFFFFF">末页</font></a>
<%
end if
end if \\'end of --->if pageCount >0 then
%>
</div>
</body>
</html>
返回类别: 教程
上一教程: 怎样经由ADO来压缩Microsoft Access数据库
下一教程: 《 优化你的ASP程序 》

您可以阅读与"分页的显示-->前后翻滚10页的实现"相关的教程:
· 分页的显示-->前后翻滚10页的实现
· VISUALINTERDEV6.0七种实现分页显示的方式
· ASP中实现分页显示的七种武器
· 在ASP中轻松实现记录集分页显示
· 分栏显示记录集的表格演示,并实现了分页
    微笑服务 优质保证 索取样品