大家谁有类似百度那样的翻页的代码,ASP的

sy_binbin 2006-03-22 08:54:52
大家谁有类似百度那样的翻页的代码,ASP的
...全文
178 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
sy_binbin 2006-03-23
  • 打赏
  • 举报
回复
上去
sy_binbin 2006-03-23
  • 打赏
  • 举报
回复
看来
sy_binbin 2006-03-23
  • 打赏
  • 举报
回复
弄出来了!结帐
sy_binbin 2006-03-22
  • 打赏
  • 举报
回复
不要沉哦
sy_binbin 2006-03-22
  • 打赏
  • 举报
回复
上去!!急啊
zwrtv 2006-03-22
  • 打赏
  • 举报
回复
收藏备用
sy_binbin 2006-03-22
  • 打赏
  • 举报
回复
select top "&n*(page-1)&" id from words Order By id Desc
告诉我 '-' 附近有语法错误。
R_Kill 2006-03-22
  • 打赏
  • 举报
回复
注释很清楚,慢慢看看!不明白再问
R_Kill 2006-03-22
  • 打赏
  • 举报
回复
dim gbcount,n,x,y,j,k
n=5 '每页显示留言数
x=10 '每页显示的页数
set rs = conn.execute("select COUNT(*) as gbcount From words")
gbcount=rs("gbcount")
rs.close

if gbcount/n = int(gbcount/n) then '计算出分页数
y=int(gbcount/n)
else
y=int(gbcount/n)+1
end if

if (page2)*x > y then '计算出每页显示的页数
k=y
else
k=(page2)*x
end if

if page=1 then '判断页数,从而从第几条记录开始读数据
j=""
else
j="where id not in (select top "&n*(page-1)&" id from words Order By id Desc)"
end if
' 在第J条记录之后取得前N条记录
'set rs = conn.execute("select top "&n&" id,name,sex,head,web,email,title,words,date,reply,ip,come,view,qq From words "&j&" Order By id Desc") '打开记录的另一种方式,这种方式效率高,但没有打开记录集,一些功能受限

Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql="select top "&n&" * From words "&j&" Order By id Desc"
Rs.Open Sql,Conn,1,1 '打开记录集

'传统的分页代码,*********开始
'TotalRecord=Rs.RecordCount '记录总数
'Rs.PageSize = 5 '每页显示的记录数
'PageSize = Rs.PageSize
'PageCount=Rs.PageCount ' 总页数
'if rs.bof and rs.eof then '错误处理
'CM="当前没有留言"
'else
'If page="" Then
'Rs.AbsolutePage = 1
'Else
'Rs.AbsolutePage = page
'End If
'end if
''*************传统的分页代码*****结
%>
<table width="500" border="0" cellspacing="1" cellpadding="4" align="center">
<tr>
<td height="20" align="right" class="unnamed1"> 有<%=gbcount %>条留言 共<%=y %>页 分页
<% if page2>1 then %>
<a href="f_2.asp?page=<%=((page2-1)*x)-(x-1) %>&k=<%=page2-1%>">前<%=x%>页</a>
<% end if %>
<% For m =((page2)*x)-(x-1) To k %>
[<a href="f_2.asp?page=<%=m%>&k=<%=page2%>"><%=m%></a>]
<%
Next
%>
<% if page2*x < y then %>
<a href="f_2.asp?page=<%=((page2+1)*x)-(x-1)%>&k=<%=page2+1%>">后<%=x%>页</a>
<% end if %>
</td>
</tr>
<% if len(webtitle)>2 then %>
<tr>
<td height="20" align="right" class="unnamed1">
<marquee onMouseOut=start(); onMouseOver=stop(); scrollamount=3>
<%=webtitle %>
</marquee></td>
</tr>
<% end if %>
</table>
<% if rs.bof and rs.eof then Response.Write "当前没有留言记录" %>

<table width="500" border="0" cellspacing="1" cellpadding="4" align="center">
<tr>
<td height="20" align="right" class="unnamed1">

有<%=gbcount %>条留言 共<%=y %>页 分页
<% if page2>1 then %>
<a href="f_2.asp?page=<%=((page2-1)*x)-(x-1) %>&k=<%=page2-1%>">前<%=x%>页</a>
<% end if %>

<% For m =((page2)*x)-(x-1) To k %>

[<a href="f_2.asp?page=<%=m%>&k=<%=page2%>"><%=m%></a>]
<%
Next
%>

<% if page2*x < y then %>
<a href="f_2.asp?page=<%=((page2+1)*x)-(x-1)%>&k=<%=page2+1%>">后<%=x%>页</a>
<% end if %>
</td>
</tr>
</table>
<% End Sub %>



sy_binbin 2006-03-22
  • 打赏
  • 举报
回复
那在页面上怎么应用呢???
sky0120 2006-03-22
  • 打赏
  • 举报
回复
<%sub list_page(TotalRec,PageSize)
'TotalTec:总记录数
'PageSize:每页显示多少条记录
TotalPage=Fix((TotalRec-1)/PageSize)+1 '得到总页数
CurrentPage=Request("page") '获得当前页
if CurrentPage="" or not isInteger(CurrentPage) then
CurrentPage=1
else
CurrentPage=clng(CurrentPage)
end if
P=(CurrentPage-1) /10
response.write"<form method=GET>页次:<b>"& CurrentPage &"</b>/<b>"& TotalPage &"</b>页  每页<b>"&PageSize&"</b> 总记录:<b>"& TotalRec &"</b></td>"&_
"<td valign=middle><div align=right >分页:"
if CurrentPage=1 then
response.write "<font face=webdings color=red>9</font>"
else
response.write "<a href='?page=1"' title=首页><font face=webdings>9</font></a> "
end if
if p*10>0 then response.write "<a href='?page="&Cstr(p*10)&"' title=上10页><font face=webdings>7</font></a> "
response.write "<b>"
for ii=p*10+1 to P*10+10
if ii=currentPage then
response.write "<font color=red>"+Cstr(ii)+"</font> "
else
response.write "<a href='?page="&Cstr(ii)&"'>"+Cstr(ii)+"</a> "
end if
if ii=TotalPage then exit for
next
response.write "</b>"
if ii<n then response.write "<a href='?page="&Cstr(ii)&"' title=下十页><font face=webdings>8</font></a> "
if currentPage=TotalPage then
response.write "<font face=webdings color=red>:</font> "
else
response.write "<a href='?page="&Cstr(TotalPage)&"' title=尾页><font face=webdings>:</font></a> "
end if
response.write "转到:<input type=text name=Page size=3 maxlength=10 value="& currentpage &"><input type=button value=Go name=submit></form>"
end sub%>

给个参考
sy_binbin 2006-03-22
  • 打赏
  • 举报
回复
顶上去
qianxiyi 2006-03-22
  • 打赏
  • 举报
回复
http://www.zj75.com/sou/
这里看看就知道了
sy_binbin 2006-03-22
  • 打赏
  • 举报
回复
大家谁还有比较好用的!!谢谢了

28,408

社区成员

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

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