关于asp 的留言板每页显示的留言个数
下面是一段留言板的ASP代码,我想将它改成每页只显示3个留言,怎么改??我现在的状况是每页显示8个留言。。。。<%IF(output=trueandsession("po...
下面是一段留言板的ASP代码,我想将它改成每页只显示3个留言,怎么改??
我现在的状况是每页显示8个留言。。。。
<%
IF (output=true and session("postboard_admin")=true) or not output=true THEN
if x0=empty or not isNUMERIC(x0) then
x0=0
elseif x0>30 then
x0=30
elseif x0<-30 then
x0=-30
end if
if x0<>0 then
rs.open "select * from message order by id "&list(x0),conn,1
maxX=1
maxY=abs(x0)
elseif x0=0 then
response.write(licence)
response.end
end if
rs.pagesize=maxX*maxY '设置和计算每页的记录数,即每页共多少图片
dim everypagesize,rscount,curpage,pgcount '每页记录数,总记录数,当前页数,总页数
everypagesize=rs.pagesize
rscount=rs.recordcount
pgcount=rs.pagecount
if request.form("page")=empty or not isNumeric(request.form("page")) then
if isNumeric(request.querystring("page")) then
curpage=cint(request.querystring("page"))
else curpage=1
end if
else
curpage=cint(request.form("page"))
end if
if curpage=empty or curpage<1 then
curpage=1
elseif curpage>pgcount then
curpage=pgcount
end if
if not rs.eof=true and not rs.bof=true then
rs.absolutepage=curpage '设置当前页数
end if
%> 展开
我现在的状况是每页显示8个留言。。。。
<%
IF (output=true and session("postboard_admin")=true) or not output=true THEN
if x0=empty or not isNUMERIC(x0) then
x0=0
elseif x0>30 then
x0=30
elseif x0<-30 then
x0=-30
end if
if x0<>0 then
rs.open "select * from message order by id "&list(x0),conn,1
maxX=1
maxY=abs(x0)
elseif x0=0 then
response.write(licence)
response.end
end if
rs.pagesize=maxX*maxY '设置和计算每页的记录数,即每页共多少图片
dim everypagesize,rscount,curpage,pgcount '每页记录数,总记录数,当前页数,总页数
everypagesize=rs.pagesize
rscount=rs.recordcount
pgcount=rs.pagecount
if request.form("page")=empty or not isNumeric(request.form("page")) then
if isNumeric(request.querystring("page")) then
curpage=cint(request.querystring("page"))
else curpage=1
end if
else
curpage=cint(request.form("page"))
end if
if curpage=empty or curpage<1 then
curpage=1
elseif curpage>pgcount then
curpage=pgcount
end if
if not rs.eof=true and not rs.bof=true then
rs.absolutepage=curpage '设置当前页数
end if
%> 展开
展开全部
pages.asp页面
<%
function showpage(totalnumber,page,filename) '参数分别为:总纪录数、当前页码、链接文件
if page=-1 then
response.Write("当前没有记录")
'response.End()
else
if page>1 and page<rs.pageCount then
response.write "<a href="&filename&"page=1>首页</a> "
response.write "<a href="&filename&"page="&page-1&">上一页</a> "
response.write "<a href="&filename& "page="&page+1&">下一页</a> "
response.write "<a href="&filename&"page="&rs.pagecount&">尾页</a> "
else
if page<2 and rs.pageCount>1 then
response.write "首页 "
response.write "上一页 "
response.write "<a href="&filename&"page="&page+1&">下一页</a> "
response.write "<a href="&filename&"page="&rs.pagecount&">尾页</a> "
'response.write "下一页 "
'response.write "尾页 "
elseif page=1 and rs.pageCount=1 then
response.write "首页 "
response.write "上一页 "
'response.write "<a href="&filename&"page="&page+1&"">下一页</a> "
'response.write "<a href="&filename&"?page="&rs.pagecount&"">尾页</a> "
response.write "下一页 "
response.write "尾页 "
else
if page>(rs.pagecount-1) then
response.write "<a href="&filename&"page=1"&">首页</a> "
response.write "<a href="&filename&"page="&page-1&">上一页</a> "
'response.write "首页 "
'response.write "上一页 "
response.write "下一页 "
response.write "尾页 "
end if
end if
end if
response.write page&"/"&rs.pagecount&"页 "
response.write "共"&rs.Recordcount&"条信息"
end if
end function
%>
显示页面 massage.asp
<!--#include file="pages.asp"-->
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from news where class1="&id&" order by id desc"
rs.open sql,conn,3,2
rs.pagesize=15
if Not IsEmpty(Request("Page")) then '如果PAGE已经初始化...
Page = CInt(Request("Page")) '接收PAGE并化为数字型赋给PAGE变量
if Page >= rs.PageCount then '如果接收的页数大于总页数
rs.AbsolutePage = rs.PageCount '设置当前显示页等于最后页
Page=rs.PageCount
elseif Page <= 0 then '如果page小于等于0
rs.AbsolutePage = rs.PageCount
Page = 1 '设置PAGE等于第一页
end if
rs.AbsolutePage = Page
else
page=1
rs.AbsolutePage=Page
End if
%>
<table width="588" border="0">
<%
For i=1 to rs.pagesize
if rs.EOF then
Exit For
end if
%>
<tr class="news">
<td width="69" style=" border-bottom:#666666 1px dashed" align="right"><img src="images/Mbg2.gif" /> </td>
<td width="215" style=" border-bottom:#666666 1px dashed" align="left"><a href="show_news.asp?id=<%=rs("id")%>" target="_blank"><%=left(rs("title"),17)%></a></td>
<td width="142" style=" border-bottom:#666666 1px dashed" align="center"><a href="show_news.asp?id=<%=rs("id")%>"target="_blank"><%=rs("time1")%></a></td>
<td width="144" style=" border-bottom:#666666 1px dashed" align="center"><a href="show_news.asp?id=<%=rs("id")%>" target="_blank"><%=rs("user")%></a></td>
</tr>
<%
rs.movenext
next
%>
</table>
<br />
<%showpage rs.RecordCount,page,"message.asp?"%>
<%
function showpage(totalnumber,page,filename) '参数分别为:总纪录数、当前页码、链接文件
if page=-1 then
response.Write("当前没有记录")
'response.End()
else
if page>1 and page<rs.pageCount then
response.write "<a href="&filename&"page=1>首页</a> "
response.write "<a href="&filename&"page="&page-1&">上一页</a> "
response.write "<a href="&filename& "page="&page+1&">下一页</a> "
response.write "<a href="&filename&"page="&rs.pagecount&">尾页</a> "
else
if page<2 and rs.pageCount>1 then
response.write "首页 "
response.write "上一页 "
response.write "<a href="&filename&"page="&page+1&">下一页</a> "
response.write "<a href="&filename&"page="&rs.pagecount&">尾页</a> "
'response.write "下一页 "
'response.write "尾页 "
elseif page=1 and rs.pageCount=1 then
response.write "首页 "
response.write "上一页 "
'response.write "<a href="&filename&"page="&page+1&"">下一页</a> "
'response.write "<a href="&filename&"?page="&rs.pagecount&"">尾页</a> "
response.write "下一页 "
response.write "尾页 "
else
if page>(rs.pagecount-1) then
response.write "<a href="&filename&"page=1"&">首页</a> "
response.write "<a href="&filename&"page="&page-1&">上一页</a> "
'response.write "首页 "
'response.write "上一页 "
response.write "下一页 "
response.write "尾页 "
end if
end if
end if
response.write page&"/"&rs.pagecount&"页 "
response.write "共"&rs.Recordcount&"条信息"
end if
end function
%>
显示页面 massage.asp
<!--#include file="pages.asp"-->
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from news where class1="&id&" order by id desc"
rs.open sql,conn,3,2
rs.pagesize=15
if Not IsEmpty(Request("Page")) then '如果PAGE已经初始化...
Page = CInt(Request("Page")) '接收PAGE并化为数字型赋给PAGE变量
if Page >= rs.PageCount then '如果接收的页数大于总页数
rs.AbsolutePage = rs.PageCount '设置当前显示页等于最后页
Page=rs.PageCount
elseif Page <= 0 then '如果page小于等于0
rs.AbsolutePage = rs.PageCount
Page = 1 '设置PAGE等于第一页
end if
rs.AbsolutePage = Page
else
page=1
rs.AbsolutePage=Page
End if
%>
<table width="588" border="0">
<%
For i=1 to rs.pagesize
if rs.EOF then
Exit For
end if
%>
<tr class="news">
<td width="69" style=" border-bottom:#666666 1px dashed" align="right"><img src="images/Mbg2.gif" /> </td>
<td width="215" style=" border-bottom:#666666 1px dashed" align="left"><a href="show_news.asp?id=<%=rs("id")%>" target="_blank"><%=left(rs("title"),17)%></a></td>
<td width="142" style=" border-bottom:#666666 1px dashed" align="center"><a href="show_news.asp?id=<%=rs("id")%>"target="_blank"><%=rs("time1")%></a></td>
<td width="144" style=" border-bottom:#666666 1px dashed" align="center"><a href="show_news.asp?id=<%=rs("id")%>" target="_blank"><%=rs("user")%></a></td>
</tr>
<%
rs.movenext
next
%>
</table>
<br />
<%showpage rs.RecordCount,page,"message.asp?"%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询