📄 13.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<base href="http://localhost:8080/" />
<title>ASP分页类</title>
<script language="javascript">
var sPath = document.location.protocol + "//" + document.location.host + document.location.pathname;
if(sPath.indexOf("/article/")>=0)
{
var sPath_tmp = sPath.split("/article/");
var BasePath = sPath_tmp[0]+"/";
document.write('<base href="'+BasePath+'" />');
}
</script>
<script language="javascript" src="images/js.js"></script>
<link href="css/css2.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="3" bgcolor="#106B61"></td>
</tr>
<tr>
<td><table width="950" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="200" height="87" align="center" background="images/index5_02.gif"><img src="images/logo.gif" width="142" height="62" /></td>
<td valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40"><table width="99%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="10%" align="left" class="red12"><strong>滚动新闻:</strong></td>
<td width="90%" align="left">
<div id="pro_demo" style="overflow:hidden;height:40px;width:660px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="pro_demo1" height="40"><table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td class="gray" nowrap="nowrap"> ·<a href="article/99.html" title="2.0版本发布">2.0版本发布</a></td>
<td class="gray" nowrap="nowrap"> ·<a href="article/89.html" title="2009-4-28更新日志">2009-4-28更新日志</a></td>
<td class="gray" nowrap="nowrap"> ·<a href="article/88.html" title="新闻系统全站静态化测试中">新闻系统全站静态化测试中</a></td>
<td class="gray" nowrap="nowrap"> ·<a href="article/83.html" title="Ok3w ASP新闻发布系统功能简介">Ok3w ASP新闻发布系统功能简介</a></td>
<td class="gray" nowrap="nowrap"> ·<a href="article/82.html" title="Ok3w ASP新闻发布系统功能简介">Ok3w ASP新闻发布系统功能简介</a></td>
<td class="gray" nowrap="nowrap"> ·<a href="article/81.html" title="Ok3w ASP新闻发布系统功能简介">Ok3w ASP新闻发布系统功能简介</a></td>
<td class="gray" nowrap="nowrap"> ·<a href="article/46.html" title="Ok3w ASP新闻发布系统功能简介">Ok3w ASP新闻发布系统功能简介</a></td>
</tr>
</table></td>
<td id="pro_demo2"></td>
</tr>
</table>
<script language="javascript" src="images/marquee.js"></script>
</div> </td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#106B61"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left"><img src="images/index5_08.gif" width="5" height="41" /></td>
<td align="center"> <a href="" class="white14b">网站首页</a> </td>
<td align="center"><img src="images/index5_11.gif" width="2" height="25" /></td>
<td align="center"> <a href="article/list_95_1.html" class="white14b">新闻资讯</a> </td>
<td align="center"><img src="images/index5_11.gif" width="2" height="25" /></td>
<td align="center"> <a href="article/list_102_1.html" class="white14b">网络安全</a> </td>
<td align="center"><img src="images/index5_11.gif" width="2" height="25" /></td>
<td align="center"> <a href="article/list_107_1.html" class="white14b">网页制作</a> </td>
<td align="center"><img src="images/index5_11.gif" width="2" height="25" /></td>
<td align="center"> <a href="article/list_85_1.html" class="white14b">办公软件</a> </td>
<td align="center"><img src="images/index5_11.gif" width="2" height="25" /></td>
<td align="center"> <a href="article/list_84_1.html" class="white14b">网站运营</a> </td>
<td align="center"><img src="images/index5_11.gif" width="2" height="25" /></td>
<td align="center"> <a href="article/list_83_1.html" class="white14b">平面设计</a> </td>
<td align="center"><img src="images/index5_11.gif" width="2" height="25" /></td>
<td align="center"> <a href="article/list_60_1.html" class="white14b">网络编程</a> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="37" align="center" background="images/index5_15.gif"><table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" class="green12gray">今天是<script language="javascript">
var mydate=new Date();
var mymonth=mydate.getMonth()+1;
var myday= mydate.getDate();
var myyear= mydate.getYear();
document.write(myyear+"-"+mymonth+"-"+myday);</script>,欢迎访问Ok3w新闻发布系统!</td>
<td align="right" class="green12gray"><a href="guest.asp">请您留言</a> | <a href="http://www.glzy8.com/ok3w/article/147.html" target="_blank">免费下载</a> | <a href="#" class="green12gray" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage(document.URL);">设为首页</a> | <a href="#" class="green12gray" onclick="window.external.AddFavorite(document.URL,document.title);">加入收藏</a></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top:2px;">
<tr>
<td align="left"><iframe id="baiduSpFrame" border="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" scrolling="no" width="468" height="60" src="http://spcode.baidu.com/spcode/spstyle/style2220.jsp?tn=zhengbi_sp&ctn=0&styleid=2220"></iframe></td>
<td align="right"><iframe id="baiduSpFrame" border="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" scrolling="no" width="468" height="60" src="http://spcode.baidu.com/spcode/spstyle/style1634.jsp?tn=zhengbi_sp&ctn=0&styleid=1634"></iframe></td>
</tr>
<tr>
<td colspan="2" align="left" height="5"></td>
</tr>
<tr>
<td align="left"><iframe id="baiduSpFrame" border="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" scrolling="no" width="468" height="60" src="http://spcode.baidu.com/spcode/spstyle/style2615.jsp?tn=zhengbi_sp&ctn=0&styleid=2615"></iframe></td>
<td align="right"><iframe id="baiduSpFrame" border="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" scrolling="no" width="468" height="60" src="http://spcode.baidu.com/spcode/spstyle/style2475.jsp?tn=zhengbi_sp&ctn=0&styleid=2475"></iframe></td>
</tr>
</table></td>
</tr>
<tr>
<td height="14" background="images/index5_31.gif"></td>
</tr>
</table>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="40">您当前位置:<a href="">网站首页</a> >> <a href="article/list_60_1.html">网络编程</a> >> <a href="article/list_61_1.html">ASP教程</a> >> 阅读文章</td>
<form id="form1" name="form1" method="get" action="search.asp">
<td width="344"><span style="font-weight: bold">站内查找:</span>
<input name="keyword" type="text" id="keyword" size="29" />
<input type="submit" name="Submit" value="搜索" />
</td>
</form>
</tr>
</table>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top"><table width="100%" border="0" cellpadding="8" cellspacing="0" style="border:1px solid #AEE1DC;">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
<tr>
<td align="center"><h1>ASP分页类</h1>
<hr size="1" color="#EBEBEB" />
来源:Ok3w建站系统 发布时间:2008-08-21 22:45:36 查看次数:<span id="News_Hits"></span><iframe style="display:none;" src="hits.asp?type=news&id=13"></iframe>
<hr size="1" color="#EBEBEB" />
</td>
</tr>
<tr>
<td style="word-break: break-all; word-wrap:break-word;"><div class="gray14"><P>该ASP分页类只是对ASP传统分页进行封装,使其分页操作更加简化,下面是代码: <BR><BR>==========Pager.asp================================= <BR><% <BR>'-------------------------------------------------------------------- <BR>'名称:ASP分页类 v2009 <BR>' <BR>'作者:<A href="http://www.glzy8.com/" target=_blank>zhengbi</A>(QQ:124895502 Email:zhengbi888@yahoo.com.cn) <BR>' <BR>'仅供参考,你可以任意修改、传播;如果你对它进行了改良,希望你能给我一个 <BR>'副本,谢谢。 <BR>'-------------------------------------------------------------------- <BR>Class TurnPage <BR> Dim sPageNo,sPageSize,sPageCount,sRecordCount,sAbsoluteRecord <BR> <BR> Private Sub Class_Initialize() <BR> sPageNo=Trim(Request.QueryString("PageNo")) <BR> If sPageNo<>"" Then <BR> sPageNo = Cdbl(sPageNo) <BR> Else <BR> sPageNo = 1 <BR> End If <BR> sAbsoluteRecord = 1 <BR> End Sub <BR><BR> Public Sub GetRs(ByRef Conn,ByRef Rs,ByVal Sql,ByVal PageSize) <BR> Rs.Open Sql,Conn,1,1 <BR> <BR> Rs.PageSize = PageSize <BR> sPageSize = Rs.PageSize <BR> sPageCount = Rs.PageCount <BR> sRecordCount = Rs.RecordCount <BR> <BR> If Not Rs.Eof Then Rs.AbsolutePage = sPageNo <BR> End Sub <BR> <BR> Public Function Eof() <BR> If sAbsoluteRecord<=sPageSize Then <BR> 'sAbsoluteRecord = sAbsoluteRecord + 1 <BR> Eof = False <BR> Else <BR> Eof = True <BR> End If <BR> End Function <BR> <BR> Public Sub MoveNext() <BR> sAbsoluteRecord = sAbsoluteRecord + 1 <BR> End Sub <BR> <BR> <BR> Public Sub GetPageList() <BR> If sPageCount<=1 Then Exit Sub <BR> <BR> Dim sURL,sTmp,sQUERY_STRING,p,n,i,a,b <BR> <BR> sURL = Request.ServerVariables("URL") <BR> sQUERY_STRING = Request.ServerVariables("QUERY_STRING") <BR> sTmp = Split(sURL,"/") <BR> sURL = sTmp(Ubound(sTmp)) <BR> If sQUERY_STRING <> "" Then sQUERY_STRING=Replace(sQUERY_STRING,"PageNo=" & sPageNo,"") <BR> If sQUERY_STRING = "" Then <BR> sURL = sURL & "?" <BR> Else <BR> sURL = sURL & "?" & sQUERY_STRING & "&" <BR> End If <BR> sURL = Replace(sURL,"&&","&") <BR> <BR> p = sPageNo-1 <BR> n = sPageNo+1 <BR> If p<1 Then p = 1 <BR> If n>sPageCount Then n = sPageCount <BR> <BR> a = sPageNo-5 <BR> b = sPageNo+5 <BR> If a<1 Then a = 1 <BR> If b>sPageCount Then b = sPageCount <BR> <BR> Response.Write("<div class=""page_nav"">") <BR> <BR> If sPageNo>1 Then Response.Write("<a href=""" & sURL & "PageNo=1"">第一页</a> <a href=""" & sURL &"PageNo=" & p & """>上一页</a>") <BR> <BR> For i=a To b <BR> If i = sPageNo Then <BR> Response.Write( " " & i) <BR> Else <BR> Response.Write(" <a href=""" & sURL & "PageNo=" & i & """>[" & i & "]</a>") <BR> End If <BR> Next <BR> If sPageNo < sPageCount Then Response.Write(" <a href=""" & sURL & "PageNo=" & n & """>下一页</a> <a href=""" & sURL & "PageNo=" & sPageCount & """>最后一页</a>") <BR><BR> Response.Write("</div>") <BR> End Sub <BR>End Class <BR>%> <BR><BR>调用示例: <BR>=============Conn.asp=============================<BR><FONT face=Verdana>Dim Conn,ConnStr,Rs<BR>ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Db.mdb")</FONT><FONT face=Verdana>Set Conn = Server.CreateObject("ADODB.Connection")<BR>Conn.Open ConnStr<BR></FONT><FONT face=Verdana>Set Rs = Server.CreateObject("Adodb.RecordSet")</FONT></P>
<P>=============test.asp============================== <BR><!--#include file="Conn.asp"--> <BR><FONT color=#0000ff><!--#include file="Pager.asp"--> <BR></FONT><% <BR>Sql="select * from Ok3w_Article where IsPass=1 and IsDelete=0 order by IsTop desc,IsCommend desc,ID desc"<BR><FONT color=#0000ff>Set Page = New TurnPage <BR>Call Page.GetRs(Conn,Rs,Sql,10)'创建Rs记录集,此处每页显示10条 <BR>Do While Not Rs.Eof And Not Page.Eof</FONT> <BR>%> <BR><a href="<%=Rs("ID")%>.html" target="_blank"><%=Rs("Title")%></a> <BR><% <BR> Rs.MoveNext <BR> <FONT color=#0000ff>Page.MoveNext</FONT> <BR>Loop <BR>Rs.Close <BR>%> <BR><FONT color=#0000ff><%Call Page.GetPageList()'显示分页导航%></FONT> <BR><% <BR><FONT color=#0000ff>Set Page = Nothing</FONT> <BR>Set Rs = Nothing <BR>Conn.Close<BR>Set Conn = Nothing <BR>%></P>
<P>比起常规分页类,操作相对要简单一点,不同之处,就是蓝色部份了。</P></div></td>
</tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -