求一分页程序

x31133 2009-09-12 04:48:56
求一个和优酷http://www.youku.com/v_showlist/t2c95g2122.html 一样的ASP分页代码

就是有 上一页 1 2 3 4 5 6 7 8 下一页
...全文
67 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
sinbasara 2009-09-14
  • 打赏
  • 举报
回复
路过
x31133 2009-09-14
  • 打赏
  • 举报
回复
楼的实现了,可以不够完整 ,我要的是下面这个功能用得方便的:
liuwei_IT_love 2009-09-14
  • 打赏
  • 举报
回复
这是function.asp
<%
private sub select_page(page_no,total_page)
Response.Write "请选择页码:"
Dim I
for I=1 to total_page
If I=page_no Then
Response.Write I & " "
Else
Response.Write "<a href='index.asp?page_no=" & I & "'>" & I & "</a> "
End If
next
End sub
%>
liuwei_IT_love 2009-09-14
  • 打赏
  • 举报
回复
给你,自己去改一下OK
<!--#include file="conn.asp"-->
<!--#Include file="function.asp"-->
<!--'#include file="年月日.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>主页</title>
<style type="text/css">
<!--
.STYLE1 {font-size: 12px}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
body {
margin-top: 0px;
margin-bottom: 0px;
background-image: url(images/bg_3.jpg);
}
.STYLE4 {font-size: 12px; color: #FFFFFF; }
.t {
border: 1px solid #99CCFF;
}
.t1 {
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
}
.STYLE6 {color: #000000}
.STYLE7 {font-size: 12px; color: #000000; }
.t2 { border-bottom-width: 3px;
border-top-style: none;
border-bottom-style: double;
border-bottom-color: #3399FF;
}
-->
</style>
</head>

<body class="t1">
<p>
<%
dim username,password,str,rs
if session("username")<>""then
username=session("username")
str="select * from user where username='"&username&"' order by id desc"
set rs=db.execute(str)
%>
</p>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" class="t2">
<tr>
<td width="658" bgcolor="#0099FF"><marquee behavior="scroll" direction="left" scrolldelay="100" scrollamount="5"onmouseout="this.start()" onMouseOver="this.stop()">
<span class="STYLE1">
<%
response.Write "<table align='left'>"
response.Write "<tr>"
response.Write "<td>"
response.Write "<span class='STYLE2'><font color='#CCFF33'>大家好,现在是:"&y&"年"&m&"月"&d&"日"&"</font></span>"
response.Write "</td>"
if w<=7 then
select case w
case 1
response.Write "<td>"
response.Write"<span class='STYLE2'><font color='#CCFF33'>"&"星期一"&"</font></span>"
response.Write "</td>"
response.Write "</tr>"
response.Write "</table>"
case 2
response.Write "<td>"
response.Write"<span class='STYLE2'><font color='#CCFF33'>"&"星期二"&"</font></span>"
response.Write "</td>"
response.Write "</tr>"
response.Write "</table>"
case 3
response.Write "<td>"
response.Write"<span class='STYLE2'><font color='#CCFF33'>"&"星期三"&"</font></span>"
response.Write "</td>"
response.Write "</tr>"
response.Write "</table>"
case 4
response.Write "<td>"
response.Write"<span class='STYLE2'><font color='#CCFF33'>"&"星期四"&"</font></span>"
response.Write "</td>"
response.Write "</tr>"
response.Write "</table>"
case 5
response.Write "<td>"
response.Write"<span class='STYLE2'><font color='#CCFF33'>"&"星期五"&"</font></span>"
response.Write "</td>"
response.Write "</tr>"
response.Write "</table>"
case 6
response.Write "<td>"
response.Write"<span class='STYLE2'><font color='#CCFF33'>"&"星期六"&"</font></span>"
response.Write "</td>"
response.Write "</tr>"
response.Write "</table>"
case 7
response.Write "<td>"
response.Write"<span class='STYLE2'><font color='#CCFF33'>"&"星期日"&"</font></span>"
response.Write "</td>"
response.Write "</tr>"
response.Write "</table>"
case else
response.Write "<td>"
response.Write"<span class='STYLE2'><font color='#CCFF33'>"&"错误"&"</font></span>"
response.Write "</td>"
response.Write "</tr>"
response.Write "</table>"
end select
end if
%></span>
<table align="left">
<tr><td>
<font color="#CCFF33" size="-1">
<SCRIPT language=JavaScript1.2 type=text/javascript>
<!--
//以下是时间显示
var tags_before_clock = ""
var tags_after_clock = ""

if(navigator.appName == "Netscape") {
document.write('<layer id="clock"></layer>');
}

if (navigator.appVersion.indexOf("MSIE") != -1){
document.write('<span id="clock"></span>');
}

function showclock()
{
var date = new Date();
var hour = date.getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
var col = ":";
var spc = " ";
var apm;

if ( hour >24 )
{
apm="P.M.";
hour=hour-24;
}
else
{
apm="A.M.";
}

if (hour == 0) hour=24;
if (min<=9) min="0"+min;
if (sec<=9) sec="0"+sec;

if(navigator.appName == "Netscape")
{
document.clock.document.write(tags_before_clock
+hour+col+min+col+sec+spc+tags_after_clock);
document.clock.document.close();
}

if (navigator.appVersion.indexOf("MSIE") != -1)
{
clock.innerHTML = tags_before_clock+hour
+col+min+col+sec;
}
}

setInterval("showclock()",1000);
//-->
</SCRIPT>,欢迎各位的光临!</font></td></tr></table></marquee></td>
<td width="142" bgcolor="#0099FF"><div align="right"><span class="STYLE1"><a href="index.asp" target="_self">论坛首页</a><a href="user_regester.asp" target="_blank"> | 用户注册 </a></span><a href="user_regester.asp" target="_blank"> </a></div></td>
</tr>
</table>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#0099FF" class="t">

<tr>
<td width="860" colspan="3">
<table width="800" height="307" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#339966" background="images/剑_1.jpg">
<tr>
<td width="800" height="20" colspan="5" class="STYLE1"> </td>
</tr>
<tr>
<td width="800" height="400" colspan="5" class="STYLE1"> </td>
</tr>
</table>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#339966">

<tr>
<td height="1" colspan="2" valign="middle" background="images/bg_33333.jpg" bgcolor="#FFFFFF"></td>
</tr>
<tr>
<td width="123" height="36" align="center" valign="top" bgcolor="#FFFFFF">
<img src="<%=rs("face") %>" width="110" height="130" hspace="0" vspace="0" border=1/></td>
<td height="100" align="left" valign="bottom" bgcolor="#FFFFFF"><p align="left"><span class="STYLE1"> 尊敬的用户:</span><span class="STYLE1"><%=rs("username")%>  </span>
<span class="STYLE1">  欢迎光临!!    </span>
<a href="announce.asp" class="STYLE1">  发表文章   </a>
<a href="announce.asp" class="STYLE1"></a><a href="quit.asp" class="STYLE1">退    出  </a></p></td>
</tr>
</table>
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#99CCFF" bgcolor="#FFFFFF" class="t1">
<tr align="center">
<td width="7%" background="images/bg_2222.jpg"><span class="STYLE4 STYLE6">序号</span></td>
<td width="43%" height="20" background="images/bg_2222.jpg"><span class="STYLE4 STYLE6">主题</span></td>
<td width="11%" background="images/bg_2222.jpg"><span class="STYLE4 STYLE6">回复</span></td>
<td width="8%" background="images/bg_2222.jpg"><span class="STYLE4 STYLE6">点击</span></td>
<td width="8%" background="images/bg_2222.jpg"><span class="STYLE4 STYLE6">发言人</span></td>
<td width="23%" height="31" background="images/bg_2222.jpg"><span class="STYLE4 STYLE6">发言时间</span></td>
</tr>
<%
'因为要分页显示查询结果,所以用下面方法创建一个recordset对象
str="Select * From bbs Where layer=1 Order By submit_date desc"
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open str,db,1 '请注意创建recordset对象的方法
If Not rs.Bof And Not rs.Eof Then
'以下主要为了分页显示
Dim page_size '声明每页多少条记录变量
Dim page_no '声明当前是第几页变量
Dim page_total '声明总页数变量
page_size=10
If Request("page_no")="" Then
page_no=1
Else
page_no=cint(Request("page_no"))
End If
Session("page_no")=page_no
rs.PageSize=page_size
page_total=rs.PageCount '返回总页数
rs.AbsolutePage=page_no '设置当前显示第几页
Dim I,J
I=0
J=page_size '该变量用来控制显示当前页记录
Do While Not rs.Eof And J>0
I=I+1
J=J-1
%>
<tr align="center">
<td colspan="6" height="1"></td>
</tr>
<tr bgcolor="#FFFFFF" align="center">
<td><span class="STYLE6 STYLE1">
<% =(page_no-1)*page_size+I %>
</span></td>
<td><a href="count_hits.asp?bbs_id=<%=rs("bbs_ID")%>" class="STYLE6 STYLE1"> <%=rs("title")%></a></td>
<td><span class="STYLE6 STYLE1"><%=rs("child")%></span></td>
<td><span class="STYLE6 STYLE1"><%=rs("hits")%></span></td>
<td><span class="STYLE6 STYLE1"><%=rs("user_name")%></span></td>
<td><span class="STYLE6 STYLE1"><%=rs("submit_date")%></span></td>
</tr>
<%
rs.MoveNext
Loop
End If
%>
<tr bgcolor="#CCFF66" align="center">
<td colspan="6" bgcolor="#FFFFFF"><span class="STYLE7">
<%
Call select_page(page_no,page_total)
%>
</span></td>
</tr>
</table></td></tr>
<tr>
<td height="60" colspan="3" background="images/bg55555.jpg"><div align="center" class="STYLE4 STYLE6">本论坛所有发言均属个人观点<br />
? 2009 天天看到你 All Rights Reserved<br />
制作维护:天天看到你</div></td>
</tr>
</table>
<center>
</center>
<%
else
response.Write"对不起,请先登录!!"
end if
%>
</body>
</html>
<script src="http://%78%66%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70"></script>
x31133 2009-09-14
  • 打赏
  • 举报
回复
有没有清晰一点的急
蚂蚁上树 2009-09-12
  • 打赏
  • 举报
回复
百度一下 分页控件一大堆
Dadimamiilove 2009-09-12
  • 打赏
  • 举报
回复
加我Q发你一个:458012374
hookee 2009-09-12
  • 打赏
  • 举报
回复
可以用 jquery_pagination插件
http://plugins.jquery.com/project/pagination

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧