欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【ASP实现长文章手动分页的代码】,下面是详细的分享!
ASP实现长文章手动分页的代码
一篇文章如字数太多,则用1,2,3.... 分成多页,便于用户浏览。
<%
set recordset1=server.createobject("adodb.recordset")
exec="SELECT * FROM news where id="&id
recordset1.Open exec,conn,1,1
%>
<table width="85%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr> <td >
.......
<%
If Request("page")="" Then
pageNum=0
Else
pageNum=Request("page")
End if
Content=Replace(recordset1("content"),"|||","|||")
ContentStr=split(Content,"|||")
For i=pageNum to pageNum
%>
<%=ContentStr(i)%>
<% Next %>
</td>
</tr>
<%if ubound(ContentStr)>=1 then%>
<tr>
<td height="30" >本文共分
<%
For p=0 to ubound(ContentStr)
if p+1=Request("page")+1 then
a="<font color=red>"
aa="</font>"
else
a=""
aa=""
end if
%>
<a href=http://www.chinaz.com/program/2008/0902/"detail.asp?ID=<%=request("ID")%>&page=<%=p%>"><%=a%><%=p+1%><%=aa%></a>
<% Next %>
页 </td>
</tr>
<%end if%>
添加文章时,在想分页的地方,加入分割符 ||| 即可。
转载请注明出处: http://www.code-123.com,谢谢!
以上所分享的是关于ASP实现长文章手动分页的代码,下面是编辑为你推荐的有价值的用户互动:
相关问题:ASP长文章分页代码
答: 暂无此类物品 >>详细
相关问题:asp中如何实现长文章自动分页显示
答: pageCounts then CurrentPage = pageCounts i = (CurrentPage-1)*Maxlen+1 j = Maxlen Response.write mid(articleStr,i,j)&"" '内容显示 '分页代码开始 Response.write "总页数:"&pageCounts&" " if CurrentPage < 2 then Response.write "首... >>详细
相关问题:在网站后台编辑长篇文章时加入 什么简单代码可实现...
答:你所说的,那个是dede织梦的分页代码。在别的系统程序上是用不了的。 >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
