<%
set rs=server.CreateObject("ADODB.recordset")
sql="select * from message order by id desc"
rs.pagesize=4
rs.open sql,conn,2,1
if not rs.eof or not rs.eof then
%>
<body bgcolor="#CCFFFF" leftmargin="40" rightmargin="40" topmargin="10">
<table align="center" border="1">
<tr height="20"><th colspan="7">留言内容</th></tr>
<%
totalput=rs.recordcount
perpagesize=rs.pagesize
currpage=request.QueryString("currpage")
if currpage="" then
currpage=1
elseif currpage<1 then
currpage=1
else currpage=clng(currpage)
end if
if currpage>rs.pagecount then
currpage=rs.pagecount
end if
if not isnumeric(currpage) then
currpage=1
end if
if (totalput mod perpagesize)=0 then
n=totalput\perpagesize
else n=totalput\perpagesize+1
end if
if n=0 then
n=1
end if
rs.move(currpage-1)*perpagesize
i=0
do while not rs.eof and i<perpagesize
%>
<tr height="20" bgcolor="#9999FF"><td width="10%">留言人</td><td width="10%"><%=rs("username")%></td>
<td width="10%">留言时间</td><td width="10%"><%=rs("messagetime")%></td><td width="10%">邮箱<%=rs("email")%></td><td width="10%">qq</td><td width="10%"><%=rs("qq")%></td></tr>
<tr height="20"><td width="10%">标题</td><td colspan="6"><%=rs("title")%></td></tr>
<tr height="20"><td colspan="7">留言内容</td></tr>
<tr height="45"><td colspan="7"><%=rs("message")%></td></tr>
<%
i=i+1
rs.movenext
loop
end if
%>
<tr height="10"><td colspan="7">
<%
k=currpage
if k<>1 then %>
<a href="displaymessage.asp?currpage=1">首页</a>
<a href="displaymessage.asp?currpage=<%=k-1%>">上一页</a>
<%else %>
首页 上一页
<% end if %>
<%
if k<>n then
%>
<a href="displaymessage.asp?currpage=<%=n+1%>">下一页</a>
<a href="diaplaymessage.asp?currpage=<%=n%>">尾页</a>
<% else
%>
下一页 尾页
<%end if%>