html5中文学习网

您的位置: 首页 > 网络编程 > ASP编程 » 正文

ASP实现长文章手动分页的代码_ASP教程_编程技术

[ ] 已经帮助:人解决问题
  <%
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.cxybl.com/html/wlbc/Asp/20120613/29965.html
VbbHTML5中文学习网 - HTML5先行者学习网
VbbHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助