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

ASP
用ASP发 WAP MAIL(-)
使用纯粹的asp+语言制作的栏目管理(一)
使用ASP方便的建立自己网站的每日更新
中文虚拟域名实现(1) (环境:中文NT)
中文虚拟域名实现(2) (环境:中文NT)
中文虚拟域名实现(3) (环境:中文NT)
最简单的ASP聊天室(附源码)
Win2k IIS 远程执行命令漏洞
搜索按钮(客户端表单)
转换字符串带有http://的超级链接字符串为真正的超级链接(源码)
第一个ASP组件:设置服务器日期时间组件
虹雨的功能较全的计数程序
下拉框连动的小例子(数据库版)
下拉框连动的小例子(.htm版)
纯ASP上传图像文件到数据库的最佳例子
数组数据排序的程序例子
网络精英计数器源程序
全文本检索的应用(1)
全文本检索的应用(2)
全文本检索的应用(3)

ASP实例代码:长文章分页代码设置方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 73 ::
收藏到网摘: 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
%>