一个功能超强大的asp分页代码, - 网站程序学习 - 卡博博客站 - powered by X-Space

一个功能超强大的asp分页代码,

上一篇 / 下一篇  2007-03-30 02:36:00 / 个人分类:计算机知识

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
    Response.Expires = 0
'**************  更改数据库名字  **************
db="../@#$$dadfe@#$/#$%a$d#eg%$%bm.mdb"'这是数据库的名称
Set Conn = Server.CreateObject("ADODB.Connection")
ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
'如果你的服务器采用较老版本Access驱动,请用下面连接方法
'ConnStr = "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(db)
Conn.Open ConnStr
'**************  关闭数据连接  **************
function CloseDatabase
Conn.close
Set Conn = Nothing
End Function
set rs=server.CreateObject("ADODB.recordset")
rs.open "select * from zx order by id desc",conn,1,1
%>
<%
'段落转换
Function textencode(str)
str=server.htmlencode(str)
str=replace(str,chr(32)," ")
str=replace(str,chr(13)&chr(10),"<br>")
textencode=str
End Function
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理</title>
<style type="text/css">
<!--
a:link {
font-family: "宋体";
font-size: 12px;
color: #000000;
text-decoration: none;
}
a:visited {
font-family: "宋体";
font-size: 12px;
color: #000000;
text-decoration: none;
}
a:hover {
font-family: "宋体";
font-size: 12px;
color: #FF0000;
text-decoration: underline;
}
a:active {
font-family: "宋体";
font-size: 12px;
color: #000000;
text-decoration: none;
}
body,td,th {
font-size: 12px;
}
-->
</style>
<style type="text/css">
<!--
#f{border-collapse:collapse;}
.style1 {font-size: 14px}
.style2 {
font-size: 16px;
font-weight: bold;
}
.style3 {color: #FFFFFF}
-->
</style>
</head>

<body>
<%

const filename = "index.asp"'此文件的文件名
const sizepage =20'设置每页记录数
const dispage = 20'设置页面上显示多少页

if rs.eof and rs.bof then%>
  <div align="center"> <br>
    没有找到任何记录</div>
  <div align="center">
      <%else
RS.PageSize = sizepage
Dim TotalPages
TotalPages = RS.PageCount

if Not isnumeric(Request.QueryString("CurPage")) or Request.QueryString("CurPage") = "" Then
CurPage = 1
Elseif Cdbl(Request.QueryString("CurPage")) > TotalPages Then
CurPage = TotalPages
Else
CurPage = Cint(Request.QueryString("CurPage"))
End If

Rs.AbsolutePage=CurPage
rs.CacheSize = RS.PageSize'设置最大记录数
Dim Totalcount
Totalcount =RS.recordcount

StartPageNum=1
do while StartPageNum+dispage<=CurPage
StartPageNum=StartPageNum+dispage
Loop

EndPageNum=StartPageNum+dispage-1

If EndPageNum>RS.Pagecount then EndPageNum=RS.Pagecount%>
  
    <br>
        
    <span class="style1"><span class="style2">在线报名管理</span> <a href="exit.asp">为了安全请点击退出</a> <br>
    </span>
</div>
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#003399" id="f">
      <tr>
        <td bgcolor="#0099FF">
<p align="center"><span class="style3">姓名</span></td>
        <td height="20" bgcolor="#0099FF" width="48"><div align="center" class="style3">
年龄</div></td> <td bgcolor="#0099FF" width="56"><div align="center" class="style3">性别 </div></td>
        <td bgcolor="#0099FF" width="233"><div align="center" class="style3">通信地址</div></td>
        <td bgcolor="#0099FF" width="135"><div align="center" class="style3">注册时间</div></td>
        <td bgcolor="#0099FF" width="231"><div align="center" class="style3">
电  话</div></td>
        <td bgcolor="#0099FF" width="79">
<p align="center">信息来源</td>
        <td bgcolor="#0099FF" width="47"><div align="center" class="style3">删除</div></td>
        <td bgcolor="#0099FF" width="52"> <div align="center" class="style3">查看</div></td>
      </tr>
<%I=0
p=RS.PageSize*(Curpage-1)
do while (Not RS.Eof) and (I<RS.PageSize)
p=p+1%>  <tr onMouseOver="bgColor='#CCCCCC'" onMouseOut="bgColor='#FFFFFF'">
  <td><div align="center" 
  title="报名
姓名:<%=rs("fname")  %>
性别:<%=rs("sex")  %>
年龄:<%=rs("age")  %>
学历:<%=rs("xueli")  %> 
所在地区:<%=rs("prov") %>
<%=rs("city")  %>
联系电话:<%=rs("telqh")  %>
<%=rs("tel")  %>
报名时间:<%=rs("ftime")  %>
 来源:<%=rs("l")  %>
 "><%=rs("fname")  %></div></td>
    <td height="20" width="48"><div align="center"><%=rs("age")  %></div></td>
    <td width="56"><div align="center"><%=rs("sex")  %></div></td>
    <td width="233"><div align="left"><%=rs("prov")  %>  <%=rs("city")  %></div></td>
    <td width="135"><div align="center"><%=rs("ftime")  %></div></td>
    <td width="231"><div align="center"><%=rs("telqh")%>-<%=rs("tel")%></div></td>
    <td width="79">
<p align="center"><%=rs("l")  %></td>
    <td width="47"><div align="center"><a href="delete_ffg.asp?id=<%=rs("id")%>" onclick="return confirm('该操作无法恢复!是否继续?')">删除</a></div></td>
    <td width="52"><div align="center"><a href="show.asp?id=<%=rs("id")%>" target="_blank">点击查看</a></div></td>
      </tr>
        <%I=I+1
RS.MoveNext
Loop%>

</table>
    <br>
    <br>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
      <tr bgcolor="">
        <td width="36%" height="21" background="../image/0000999.jpg" bgcolor="">页次:<b><font color="#FF0000"><%=CurPage%></font>/<%=TotalPages%></b> 每页<b><%=sizepage%></b> 总记录数<b><%=rs.recordcount%> </b></td>
        <td width="64%" background="../image/0000999.jpg" bgcolor=""><div align="right">分页:
                <%if CurPage>dispage then%>
                <a href="<%=filename%>?CurPage=1"><font face=webdings title="首页">9</font></a>
                <%end if%>
                <%if CurPage>dispage then%>
                <a href="<%=filename%>?CurPage=<%=StartPageNum-1%>"><font face=webdings title="上<%=dispage%>">7</font></a>
                <%end if
                  For I=StartPageNum to EndPageNum
                  if I<>CurPage then %>
                <a href="<%=filename%>?CurPage=<%=I%>"><b><%=I%></b></a>
                <% else %>
                <font color="#FF0000"><b><%=I%></b></font>
                <% end if
                  Next %>
                <% if EndPageNum<RS.Pagecount then %>
                <a href="<%=filename%>?CurPage=<%=EndPageNum+1%>"><font face=webdings title="下<%=dispage%>">8</font></a>
                <%end if
                  if CurPage<TotalPages then%>
                <a href="<%=filename%>?CurPage=<%=TotalPages%>"><font face=webdings title="尾页">:</font></a>
                <%end if%>
        </div></td>
      </tr>
</table>
<p>
    <%
end if
rs.close
set rs=nothing
%> 
    <br>
</p>
</body>
</html>

TAG: 功能 asp

引用 删除 Guest   /   2007-09-24 07:50:22
5
 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-12-20  
 123456
78910111213
14151617181920
21222324252627
28293031   

我的存档

数据统计

  • 访问量: 10521
  • 日志数: 350
  • 建立时间: 2006-03-29
  • 更新时间: 2006-03-29

RSS订阅

Open Toolbar