做了一个ASP的页子,分页显示的时候点下一页总是只能显示第二页的内容:
问题页面见:
http://www.icebo.com/mm/index.asp(是一个图片欣赏页面)
问题页只要代码:
<%
sql="select * from bobo order by t desc"
set rs= Server.CreateObject("ADODB.RecordSet")
rs.Open sql, Conn, 1, 2
page=Request("page")
if page=0 then
page=1
end if
RecordCount = 0
do while not rs.Eof
RecordCount = RecordCount +1
rs.MoveNext
loop
if not RecordCount=0 then
rs.MoveFirst
end if
pageCount=RecordCount/25
pageCount=int(pageCount)
if (RecordCount mod 25)>0 then
PageCount=PageCount +1
end if
if pagecount=0 then pagecount=1
if page>pagecount then page=pagecount
do while pos<(page-1)*25
pos=pos+1
rs.moveNext
loop
x=0
do while x<25 and not rs.eof%>
<tr>
<td class=top1> <%if rs("gd")=1 then
response.write"<img src=""images/istop.gif"" alt=""置顶的帖子""> "
elseif rs("jh")=1 then
response.write"<img src=""images/isbest.gif"" alt=""特别推荐"">"
elseif rs("jh")=0 and rs("hits")<50 then
response.write"<img src=""images/folder.gif"" alt=""美女图片""> "
elseif rs("jh")=0 and rs("hits")>=50 then
response.write"<img src=""images/hotfolder.gif"" alt=""大家都喜欢,你呢?"">"
elseif rs("jh")=2 then
response.write"<img src=""images/lockfolder.gif"" alt=""这个就不看了吧!""> "
end if%> <a href="newsfile/<%=rs("url")%>.htm" target="_blank"><%=rs("title")%></a>
</td>
<td class=below4><font size=-1> <%=rs("t")%></font></td>
</tr>
<%x=x+1
rs.movenext
loop
rs.close
set rs=nothing
%>
</table>
<table width="760" border="0" align="center" cellpadding="3" cellspacing="0"
bordercolor="#FF00FF" bgcolor="49ade9">
<form method=post action=index.asp>
<tr>
<td width="52%" > 页次:
<%if page="" then
response.write"1"
else
response.write page
end if%>
/ <%=pageCount%> 页 主题数:<%=RecordCount%></td>
<td width="48%" align="right">
<%if page=1 then
response.write"首页"
else
response.write"<a href=index.asp class=a1>首页</a> "
end if%>
<%if page=1 then %>
上一页
<%else%>
<a href="index.asp?page=<%=page-1%>" class=a1>上一页</a>
<%end if%>
<% y=1%>
<%do while y<pagecount+1%>
<a href="index.asp?page=<%=y%>" class=a1><%=y%></a>
<%
y=y+1
loop%>
<%if cint(page)=pagecount then %>
下一页
<%else%>
<a href="index.asp?page=<%=page+1%>" class="a1">下一页</a>
<%end if%>
转到:
<input onMouseOver="this.style.backgroundColor = '#E5F0FF'" style="BORDER-RIGHT:
#b4b4b4 1px double; BORDER-TOP: #b4b4b4 1px double; BORDER-LEFT: #b4b4b4 1px double; COLOR:
#8888aa; BORDER-BOTTOM: #b4b4b4 1px double; BACKGROUND-COLOR: #ffffff"
onMouseOut="this.style.backgroundColor = ''" maxlength=3 size=3 name=page value="<%=page%>">
页
<input onMouseOver="this.style.backgroundColor='#FFC864'" style="BORDER-RIGHT: 1px
solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; COLOR: #000000; BORDER-BOTTOM: 1px
solid; HEIGHT: 18px; BACKGROUND-COLOR: #f3f3f3"
onMouseOut="this.style.backgroundColor='#f3f3f3'" type=submit value=GO name=submit>
</td>
</tr>
</form>
</table>