网站首页

家园论坛

老版论坛

家园博客

业界新闻

技术文档

下载中心

速查中心

图片中心

硬件资讯
上一篇:使用JavaScript和AJAX发出异步请求 下一篇:浅谈ASP程序实现自动采集程序及入库
ASP简单的ajax留言板(采用三层模式)

来源: 作者: 添加日期:2006-6-12 20:17:58 点击次数:

MOD_Guest.asp

<%
 '/// <summary>
 '/// 摘要说明。
 '/// </summary>
 Class MOD_Guest

  Public Id
  Public Content
  Public Re
  Public Addtime
  Public Ip

  Public Sub SetVar(vId,vContent,vRe,vAddtime,vIp)
   Id=vId
   Content=vContent
   Re=vContent
   Addtime=vAddtime
   Ip=vIp
  End Sub

 End Class
%>

Common.asp

<%
 '/// <summary>
 '/// 摘要说明
 '/// </summary>
 Class Common

  '/// <summary>
  '/// 获得信息
  '/// </summary>
  '/// <param name="Id">需要内容</param>
  '/// <param name="Id">替换关键字</param>
  '/// <returns>格式化后内容</returns>
  Public Function Format(str,arr)

   Dim r,i
   r = str  
   For i = 0 To UBound(arr)
    r = Replace(r,"{"&i&"}",arr(i))
   Next
   Format = r

  End Function

  Public Function Page(PageSize,CurrentPage,RecordCount,PageUrl)
  
   const C_RECORDCOUNT = "合计<STRONG><FONT color=""red"">{0}</FONT></STRONG>篇&nbsp;|"
   const C_FIRSTPAGE1 = "&nbsp;<a href=""#"" onclick=""$('{0}&amp;PageNo={1}')"">首页</a>"
   const C_FIRSTPAGE2 = "&nbsp;首页"
   const C_PREVPAGE1 = "&nbsp;<a href=""#"" onclick=""$('{0}&amp;PageNo={1}')"">上一页</a>"
   const C_PREVPAGE2 = "&nbsp;上一页"
   const C_NEXTPAGE1 = "&nbsp;<a href=""#"" onclick=""$('{0}&amp;PageNo={1}')"">下一页</a>"
   const C_NEXTPAGE2 = "&nbsp;下一页"
   const C_LASTPAGE1 = "&nbsp;<a href=""#"" onclick=""$('{0}&amp;PageNo={1}')"">尾页</a>"
   const C_LASTPAGE2 = "&nbsp;尾页"
   const C_CURRENTPAGE = "&nbsp;页次:<STRONG><FONT color=""red"">{0}</FONT>/{1}</STRONG>页"
   const C_PAGESIZE = "&nbsp;<STRONG>{0}</STRONG>篇/页&nbsp;&nbsp;"
   const C_GOTOPAGE = "&nbsp;跳转:<input type=""text"" name=""goto"" value=""{1}"" onchange=""$('{0}&amp;PageNo='+this.value)"" style=""width:20px;border:1px""/>&nbsp;&nbsp;"
  
   Dim PageCount,pages
   Dim lRecordCount,lFirstpage,lPrevpage,lNextpage,lLastpage,lCurrentpage,lPagesize,lGotopage
   Dim p,parms

   If RecordCount Mod PageSize <> 0 Then
    pages = 1
   else
    pages = 0
   End If
   PageCount=CInt(RecordCount/PageSize + pages)
  
   parms=Array(RecordCount)
   lRecordCount = Format(C_RECORDCOUNT,parms)

   if CInt(CurrentPage)>1 Then
    parms=Array(Pageurl,1)
    lFirstpage = Format(C_FIRSTPAGE1,parms)
    parms=Array(Pageurl,CInt(CurrentPage)-1)
    lPrevpage = Format(C_PREVPAGE1,parms)
   Else
    lFirstpage=C_FIRSTPAGE2
    lPrevpage=C_PREVPAGE2
   End If

   if CInt(CurrentPage)<PageCount Then
    parms=Array(Pageurl,CInt(CurrentPage)+1)
    lNextpage = Format(C_NEXTPAGE1,parms)
    parms=Array(Pageurl,CInt(CurrentPage)+1)
    lLastpage = Format(C_LASTPAGE1,parms)
   Else  
    lNextpage=C_NEXTPAGE2
    lLastpage=C_LASTPAGE2
   End If

   parms=Array(CurrentPage,PageCount)
   lCurrentpage = Format(C_CURRENTPAGE,parms)
   parms=Array(PageSize)
   lPagesize = Format(C_PAGESIZE,parms)
   parms=Array(Pageurl,CurrentPage)
   lGotopage = Format(C_GOTOPAGE,parms)
  
   p=lRecordCount&lFirstpage&lPrevpage&lNextpage&lLastpage&lCurrentpage&lPagesize&lGotopage
   Page = p

  End Function

 End Class
%>

本新闻共4页,当前在第3页  1  2  3  4  

 
设为首页 | 加入收藏 | 业务办理 | 友情链接 | 论坛版面 | 浙ICP备07502118号 |