to do to doing的区别:ASP代码,有关分页部分的的,帮帮忙?

来源:百度文库 编辑:中科新闻网 时间:2024/03/29 17:57:04
if rs.eof and rs.bof then
response.write "<p align='center'>没有找到相关的新闻</p>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if

if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"search.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
showContent
showpage totalput,MaxPerPage,"search.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"search.asp"
end if
end if
rs.close
end if
sub showContent
dim i
i=0
do while not rs.eof
a_time=FormatDateTime(rs("news_time"))
a_title=trim(rs("title"))
if Len(minute(a_time))=1 then
a_minute="0"&minute(a_time)
else
a_minute=minute(a_time)
end if
什么意思呢?
能说得详细点么?

<div id="listnews">
<%
exec="select * from webnews order by id desc"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
if rs.eof then
response.write"数据库中没有记录!"
else
rs.PageSize=25
pagecount=rs.PageCount
page=int(request.QueryString ("page"))
if page<=0 then page=1
if request.QueryString("page")="" then page=1
rs.AbsolutePage=page
rssum=rs.recordcount
if page>rs.pagecount then
response.write"你输入的页不存在,请查正后在来"
else
for i=1 to rs.PageSize
%>
<div id="row" >

<div id="list2">
<img src="img/i9.gif" width="15" height="10" border="0" /><a href="read.asp?id=<%=rs("id")%>" target="_blank" class="black"> <%=rs("title")%></a>
</div>
<div id="list3">
<%=tim(rs("time"))%>
</div>
</div>
<%rs.MoveNext
If rs.Eof Then
Exit For
End If
Next
end if%>

</div>
<div align="center" id="pages">
总共有<font color="red"><%=rssum%></font>条新闻||共有<font color="red"><%=pagecount%></font>页,
当前是<font color="red"><%=page%></font>页||
<%if rssum<rs.pagesize then%>
<%response.write"下一页||上一页||首页||末页"%>
<%elseif page=1 and rssum>rs.pagesize then%>
<a href="?page=<%=page+1%>"><font color="#6633CC">下一页</font></a>||
上一页||首页||<a href="?page=<%=pagecount%>"><font color="#9999ff">末页</font></a>
<%elseif page=pagecount and rssum>rs.pagesize then%>
下一页||<a href="?page=<%=page-1%>"><font color="#3333cc">上一页</font></a>||
<a href="?page=1"><font color="#cc99ff">首页</font></a>||末页
<%else%>
<a href="?page=<%=page+1%>">下一页</a> ||<a href="?page=<%=page-1%>">上一页</a>||
<a href="?page=1">首页</a>|| <a href="?page=<%=pagecount%>">末页</a>
<% end if%>
</div>
<% End If
rs.close
set rs=Nothing
conn.close
set conn=nothing
%>
</div>

这个是我的,你看一看吧!