中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > Web开发 > Asp > 综合文章
(原创)另类的[分页显示效果]?!
作者:未知 时间:2004-09-16 12:12 出处:Blog 责编:chinaitpower
              摘要:暂无

什么都不做,就是查询数据,一页显示多少条就查询多少条数据出来。这样的速度应该是很快的了吧?哈哈。。思路就是,给ID值出来,使用此ID值做下一页或上一页的查询条件,并且还要排序!!在这里查询结果排序也起了很重要的作用!!!!


示例代码如下:
<!--#include file="Conn.asp"-->
<%
Dim aFlag,NowID,LastID,iShowNum
iShowNum=20                   '一页显示多少条记录
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
td {
 font-family: "宋体";
 font-size: 12px;
}
a:link {
 font-family: "宋体";
 font-size: 12px;
 color: #999999;
 text-decoration: none;
}
a:visited {
 font-family: "宋体";
 font-size: 12px;
 color: #999999;
 text-decoration: none;
}
a:active {
 font-family: "宋体";
 font-size: 12px;
 color: #999999;
 text-decoration: none;
}
a:hover {
 font-family: "宋体";
 font-size: 12px;
 color: #FF9900;
 text-decoration: underline;
}
-->
</style>
</head>

<body>
<table width="750"  border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#D5D5D5">
  <tr bgcolor="#F3F3F3">
    <td width="10%" height="25" bgcolor="#F3F3F3"><div align="center"><strong>序号</strong></div></td>
    <td width="25%" height="25"><div align="center"><strong>电影名称</strong></div></td>
    <td width="57%" height="25" bgcolor="#F3F3F3"><div align="center"><strong>电影URL地址</strong></div></td>
    <td width="8%" height="25"><div align="center"><strong>类型</strong></div></td>
  </tr>
<%
Call Show_List
%>
  <tr bgcolor="#F3F3F3">
    <td height="20" colspan="4"><div align="right"><a href="Index.asp?aFlag=Fir">[首页]</a>&nbsp;&nbsp;<a href="Index.asp?aFlag=Pre&sID=<%=NowID%>">[上一页]</a>&nbsp;&nbsp;<a href="Index.asp?aFlag=Nex&sID=<%=LastID%>">[下一页]</a>&nbsp;&nbsp;<a href="Index.asp?aFlag=End">[尾页]</a></div></td>
  </tr>
</table>
</body>
</html>
<%
Call CloseDatabase

Sub Show_List
Dim LastFlag,NowFlag
Dim ArrayRow
 aFlag=Request("aFlag")
 NowID=Request("sID")
 Select Case aFlag
        Case "Nex"
          If NowID<>"" Then
             Sql="Select Top "&iShowNum&" Id,Name,Url,Type From [Movie] Where ID>"&NowId&" Order By ID Asc"
    Else
       Sql="Select Top "&iShowNum&" Id,Name,Url,Type From [Movie] Order By ID Desc"
    End If
     Case "Pre"
          If NowID<>"" Then
             Sql="Select Top "&iShowNum&" Id,Name,Url,Type From [Movie] Where ID<"&NowId&" Order By ID Desc"
    Else
       Sql="Select Top "&iShowNum&" Id,Name,Url,Type From [Movie]"
    End If
     Case "End"
          Sql="Select Top "&iShowNum&" Id,Name,Url,Type From [Movie] Order By ID Desc"
     Case Else
          Sql="Select Top "&iShowNum&" Id,Name,Url,Type From [Movie]"
 End Select
 Set Rs=Conn.Execute(Sql)
 LastFlag=False
 NowFlag=False
 If Rs.Eof Then
    Rs.Close
    Set Rs=Nothing
    Exit Sub
 End If
 '获取数据到一个二维数组
 ArrayRow=Rs.GetRows()
 Dim iFrom,iTo,iStep
 If aFlag="Pre" Or aFlag="End" Then
    iFrom=Ubound(ArrayRow,2)
    iTo=0
    iStep=-1
 Else
    iFrom=0
    iTo=Ubound(ArrayRow,2)
    iStep=1
 End If
 NowID=ArrayRow(0,iFrom)
 LastID=ArrayRow(0,iTo)
 For i=iFrom To iTo Step iStep
    Response.Write " <tr bgcolor=""#FDFDFD"" style=""cursor:hand"" onmouseover=""this.style.background='#F3F3F3'"" onmouseout=""this.style.background='#FDFDFD'"">"
    Response.Write "    <td height=""20""><div align=""center"">"&ArrayRow(0,i)&"</div></td>"
    Response.Write "    <td>"&ArrayRow(1,i)&"</td>"
    Response.Write "    <td>"&ArrayRow(2,i)&"</td>"
    Response.Write "    <td>"&ArrayRow(3,i)&"</td>"
    Response.Write "  </tr>"
    Next
 Rs.Close
 Set Rs=Nothing
End Sub
%>

关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有