ASP+Ajax实现无刷新评论简单例子
程序员文章站
2022-05-03 08:04:11
<% dim curpage curpa...
<!--#include file="command.asp" -->
<%
dim curpage
curpage=cint(request("page"))
if curpage = empty or curpage<1 then
curpage = 1
end if
response.contenttype="application/xml"
response.charset="gb2312"
response.expires=0
response.write("<?xml version=""1.0"" encoding=""gb2312""?>")
dim rs,sql '定义连接数据库对象
set rs=server.createobject("adodb.recordset")
sql="select * from rev order by id desc"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.write("<data page=""0"" p_nums=""0"">")
response.write("<content>没有留言</content>")
response.write("</data>")
response.end
else
dim perpage,p_nums,pagecountn,d_nums
perpage=3
rs.pagesize=perpage
rs.absolutepage=curpage
p_nums=rs.pagecount
d_nums=rs.recordcount
response.write("<data page="""&curpage&""" p_nums="""&p_nums&""" d_nums="""&d_nums&""">")
do until rs.eof or pagecountn=perpage
response.write("<author posttime="""&formattime(rs("posttime"))&"""><![cdata["&rs("memcontent")&"]]></author>")
response.write("<content><![cdata["&rs("memcontent")&"]]></content>")
rs.movenext
pagecountn=pagecountn+1
loop
end if
response.write("</data>")
%>
<%
dim curpage
curpage=cint(request("page"))
if curpage = empty or curpage<1 then
curpage = 1
end if
response.contenttype="application/xml"
response.charset="gb2312"
response.expires=0
response.write("<?xml version=""1.0"" encoding=""gb2312""?>")
dim rs,sql '定义连接数据库对象
set rs=server.createobject("adodb.recordset")
sql="select * from rev order by id desc"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.write("<data page=""0"" p_nums=""0"">")
response.write("<content>没有留言</content>")
response.write("</data>")
response.end
else
dim perpage,p_nums,pagecountn,d_nums
perpage=3
rs.pagesize=perpage
rs.absolutepage=curpage
p_nums=rs.pagecount
d_nums=rs.recordcount
response.write("<data page="""&curpage&""" p_nums="""&p_nums&""" d_nums="""&d_nums&""">")
do until rs.eof or pagecountn=perpage
response.write("<author posttime="""&formattime(rs("posttime"))&"""><![cdata["&rs("memcontent")&"]]></author>")
response.write("<content><![cdata["&rs("memcontent")&"]]></content>")
rs.movenext
pagecountn=pagecountn+1
loop
end if
response.write("</data>")
%>
上一篇: Ajax留言本源码 提供下载了
下一篇: ajax中文乱码问题解决方案