加入收藏 | 设为首页 | 会员中心 | 我要投稿 常州站长网 (https://www.0519zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

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

发布时间:2024-01-02 03:18:42 所属栏目:Asp教程 来源:DaWei
导读: ASP如何实现长文章手动分页的代码:

<%
set recordset1=server.createobject("adodb.recordset")
exec="SELECT * FROM news where id="&id
recordset1.Open exec,conn,1,1
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 
ContentStr=split(recordset1("detail"),"||")
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%> 
 
添加文章时,在想分页的地方,加入分割符 || 即可。

(编辑:常州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章