统计在线人数...

ASP实现长文章手动分页的代码

[ 来源:CHINAZ用户投稿 | 作者:佚名 | 时间:2008-9-2 上午 04:15:56 | 浏览:统计中... ]

一篇文章如字数太多,则用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="detail.asp?ID=<%=request("ID")%>&page=<%=p%>"><%=a%><%=p+1%><%=aa%></a> 
              <% Next %>
              页 </td>
          </tr>
          <%end if%>

添加文章时,在想分页的地方,加入分割符 ||| 即可。

 转载请注明出处: http://www.code-123.com,谢谢!

共有0人参与评价,平均得分:0分
评论内容只代表网友观点,与本站立场无关! 查看完整内容
   

当前在线人数
QQ:748838 MSN:allen_xia#msn.com E-mail:allenxia666#126.com QQ群:站长联盟北方区-北京(28200145) 站长联盟南方区-上海(67713522)