当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP实例代码:搞个长文章分页代码

ASP
如何使用ASP产生象安装向导的主页
ADO如何取得数据库中表的字段信息之一
ADO如何取得数据库中表的字段信息之二
网页计数器的程序
实验Recordset.Movenext,Recordset.Previous,Recorset...等移动记录
不能ASP图像组件来生成图像的ASP计数器程序(一)
IIS5 + ADO 2.5新先睹为快技术(一)
IIS5 + ADO 2.5新先睹为快技术(二)
如何使用 Microsoft Access 和 Active Server Pages 加密你的页面
WINDOWS 2000搭載ASP3.0和IIS5.0
IIS 5.0新功能
网络开发之编程技巧之一(有效验证用户的登录)
如何使用ASP在自己的网站建立投票机制(一)
如何使用ASP在自己的网站建立投票机制(二)
组件对象开发Web应用的实例分析
如何实现动态添加Html文档中Form项
一个BBS的源代码(一)
一个BBS的源代码(二)
一个BBS的源代码(三)
一个BBS的源代码(四)

ASP实例代码:搞个长文章分页代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 98 ::
收藏到网摘: n/a

 

以下为引用的内容:

<%
Class aspxsky_page
 Private Sub class_initialize
 End Sub

 Public Function Alert(message,gourl)
    message = replace(message,"'","\'")
    If gourl="-1" then
        Response.Write ("<script language=javascript>alert('" & message & "');history.go(-1)</script>")
    Else
        Response.Write ("<script language=javascript>alert('" & message & "');location='" & gourl &"'</script>")
    End If
    Response.End()
 End Function

 Public Sub showpage(str,page,url)
  if not isnumeric(page) then
    alert "提示:错误的参数!","-1"
  end if
  if page="" or page=0 or isnull(page) or isempty(page) then
    page=1
  else
    page=cint(page)
  end if
  str=split(str,"{nextpage}")
  abspage=page
  pcount=ubound(str)+1
  if page>cint(ubound(str)+1) or page<1 then
alert "提示:错误的参数!","-1"
  else
response.write str(page-1)&"<br><br><center> 共分为"&pcount&"页 "
  end if

  for p=0 to ubound(str)
 response.write "<a href="&url&"p="&p+1&">["&p+1&"]</a> "
  next
  response.write "当前第"&abspage&"/"&pcount&"页</center>"
 End Sub
End Class

'------------------调用-----------------------
p=request.QueryString("p")
str="第一页:这里是第一页的内容{nextpage}第二页:这里是第二页的内容"
url="shownews.asp?id="&id&"&"
set newpage=new aspxsky_page
newpage.showpage str,p,url
%>