标题:向高手求教ASP翻页的问题
只看楼主
xxn0128
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-5-12
 问题点数:0 回复次数:0 
向高手求教ASP翻页的问题
请各位高手帮小弟查一下原因,第一页显示正常,点下一页或选择转到哪一页,就出现文章正文内容,而不是象第一页界面格式一样显示



dim PerPage,page
page = request("page")
if page <>"" and IsNumeric(page) = false then
Response.Write("<script>alert('Sorry!\n\分页参数错误!');window.history.back();</script>")
response.End()
Call DBConnEnd()
end if
rs.open sql,conn,1,1
PerPage=14
'假如没有数据时
'取得页数,并判断用户输入的是否数字类型的数据,如不是将以第一页显示
text="0123456789"
rs.PageSize=PerPage
for i=1 to len(page)
checkpage=instr(1,text,mid(page,i,1))
if checkpage=0 then
exit for
end if
next

If checkpage<>0 then
If NOT IsEmpty(page) Then
CurrentPage=Cint(page)
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > rs.PageCount Then CurrentPage = rs.PageCount
Else
CurrentPage= 1
End If
If not rs.eof Then rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
%>
                                                <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                                                  <tr>
                                                    <td><%i=0
do while not rs.eof%>
                                                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                          <tr>
                                                            <td width="30" height="30" align="center"><img src="img/item_13.gif" width="7" height="9"></td>
                                                            <td height="25" align="left">&nbsp;&nbsp;<a href="newsinfo.asp?id=<%=rs("id")%>"><%=cutstr(rs("title"),40)%></a></td>
                                                            <td width="100" align="right">[<%=FormatDateTime(rs("UpdateTime"),vbShortDate)%>]</td>
                                                          </tr>
                                                        </table>
                                                      <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                          <tr>
                                                            <td height="1" background="img/shixian1.jpg"></td>
                                                          </tr>
                                                      </table>
                                                      <%i=i+1
rs.movenext
if i=PerPage then
exit do
end if
loop
%>                                                    </td>
                                                  </tr>
                                                  <tr>
                                                    <td height="30" align="right"><%
if rs.PageCount>1 then
Response.write "<font color='#000000'>-> 全部-共</font>"
Response.write "</font>" & "<font color=#FF0000>" & Cstr(rs.RecordCount) & "</font>" & "<font color='#000000'>条信息</font>&nbsp;"
Response.write "<font color='#000000'>第</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) &  "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "页</font>&nbsp;"& PerPage &"条/页&nbsp;"
If currentpage > 1 Then
response.write "<a href='?big="&big&"&page="+cstr(1)+"'><font color='#000000'>首页</font></a><font color='#ffffff'> </font>"
Response.write "<a href='?big="&big&"&page="+Cstr(currentpage-1)+"'><font color='#000000'>上一页</font></a><font color='#ffffff'> </font>"
Else

Response.write "<font color='#000000'>上一页 </font>"

End if
If currentpage < rs.PageCount Then
Response.write "<a href='?big="&big&"&page="+Cstr(currentPage+1)+"'><font color='#000000'>下一页</font></a><font color='#ffffff'> </font>"
Response.write "<a href='?big="&big&"&page="+Cstr(rs.PageCount)+"'><font color='#000000'>尾页</font></a>&nbsp;&nbsp;"
Else
Response.write ""
Response.write "<font color='#000000'>下一页</font>&nbsp;&nbsp;"
End if
response.write "<font color='#000000' >转到:</font>"
response.write ("<select name=""select"" style='font-size: 9pt;' onChange=""window.location=this.value""><option value=1 checked>请选择</option>")
for i=1 to rs.PageCount
response.write("<option value=""?big="&big&"&page="&i&""">第"&i&"页</option>")
next
response.write("</select>")
end if
rs.close
%></td>
                                                  </tr>
                                              </table></td>
                                          </tr>
                                      </table></td>
                                    </tr>
                                    <tr>
                                      <td>&nbsp;</td>
                                    </tr>
                                  </tbody>
                                </table>
        <% end sub:sub pic() %>
                                <table width="100%" border="0" cellpadding="15" cellspacing="0">
                                  <tr>
                                    <td><table width="100%" height="220" border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                          <% sql = "select id,title,wfile,Content from main where BigClassName='"&big&"'"
                                          if small<>"" then
                                          sql=sql&" and SmallClassName='"&small&"'"
                                            end if
                                            sql=sql&" order by Id desc"
                                
搜索更多相关主题的帖子: false 正文 文章 
2011-05-12 16:55



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-339631-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.126894 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved