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

2008-09-02 13:20:50 北京时间
一篇文章如字数太多,则用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,谢谢!




发表评论

请文明参与讨论,禁止漫骂攻击。本站保留不刊登无关和不雅评论的权力。


用户名: 密码: 匿名

相关新闻
计算分页,嘿嘿一次搞定不用判断 以下为引用的内容: intNumPage
一般来说我们都是用 Hashtable 的 ContainsKey 方法来查找 Hasht
引言 随着现代科技日新月异的发展,作为新兴产业的嵌入式移动信
出于安全考虑,几乎每个动态网站都具备 IP 地址屏蔽功能,而网上
问: Service Unavailable 是什么意思啊?? 答: Service Unava

广告
© 2008 The Czz5 Company. All Rights Reserved. 关于我们 - 联系我们 - 广告业务 - 网站地图 - 版权声明 - 友情连接 - 网站投稿 - 致信编辑