主题:  菜鸟求助,如何加入转到某页的翻页功能?

vt40

职务:普通成员
等级:2
金币:1.0
发贴:273
#12005/7/29 2:53:28

图片如下:

下在这个只有上一页和下一页/
要一页一页地翻, 可否直接去第XX页.如图


<!--#include file="top.asp"-->
<%
	
	dim sort_id, sort_name, Nsort_id, Nsort_name
   	dim totalPut   
   	dim CurrentPage, TotalPages
   
        if request("sort_id")<>"" then
		sort_id=request("sort_id")
   	else
		sort_id=0
   	end if
	if request("sort_id")="" then 
	sort_id=1
	end if
   	if not isempty(request("page")) then
      		currentPage=cint(request("page"))
   	else
      		currentPage=1
   	end if
    
	dim order
	if request("order")<>"" then 
	    order=request("order")
		else
		order="time"
		end if
		'rs.close
   	'else
	'	Nsort_id=0
	'	Nsort_name="Category"
   '	end if
 
  sql="select * from sort where sort_ID="&cstr(sort_id)
   rs.open sql,conn,1,1
	if not rs.eof then
	sort_name=rs("sort_name")
 	end if
	rs.close
%>

<table width=778 border=0 align="center" cellpadding=0 cellspacing=0 bgcolor="#FEFEFE">
  <tbody> 
  <tr> 
    <td width=181 align="center" valign="top" background="images/leftbg.jpg"><!--#include file="insearch.asp"--><!--#include file="left.asp"--></td>
    <td  height=150 valign="top"> 
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-bottom: 6" height="346">
        <tr bgcolor="#FFFFFF"> 
          <td height="346" colspan="2" align="center" valign="top"> 
            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-bottom: 6">
              <tr> 
                <td height="100" colspan="2" bgcolor="#FFFFFF"> 
                  <div align="center"></div>
                  <table height="5" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                                   <%set rs=server.createobject("adodb.recordset")
sort_id=trim(request("sort_id"))
      if sort_id=empty then
          response.redirect "index.asp"
      end if
       
      page=request.querystring("page")
      if page="" then page=1
      if not(isnumeric(page)) then page=1
      if page<1 then page=1
      page=int(page)
      
if Nsort_id<>0 then
	sql="select * from hw where Nsort_id="+cstr(Nsort_id)+" and sort_id="+cstr(sort_id)+"  order by hw_id desc" 
elseif sort_id<>0 then
	sql="select * from hw where sort_id="+cstr(sort_id)+" order by hw_id desc" 
else
	sql="select * from hw order by hw_id desc"
end if

if order="time" then
    sql="select * from hw where sort_id="+cstr(sort_id)+" order by hw_id desc"
	elseif order="price1" then
    sql="select * from hw where sort_id="+cstr(sort_id)+" order by hw_cash desc , hw_id desc"
	elseif order="price2" then
	sql="select * from hw where sort_id="+cstr(sort_id)+" order by hw_cash asc , hw_id desc"
	end if
	
	  
      rs.open sql,conn,3,3
      if rs.eof then
          response.write "The category that you choose have no merchandise"
          response.end
      else
          rs.pagesize=8
          totalrec=rs.recordcount
          totalpage=rs.pagecount
          if page>totalpage then page=totalpage
          rs.absolutepage=page
          rs.cachesize=rs.pagesize
          %>
                    <tr> 
                      <td  height="2"> 
<div align="center">
<table width="100%" border="0" bgcolor="#F7F7F7">
                                  <tr> 
                                    <td style="border-left-width: 1px; border-right-width: 1px; border-top: 1px solid #C8C8C8; border-bottom: 1px solid #C8C8C8" bgcolor="#F7F7F7" height="25"><div align="left"><%=sort_name%>,ALL<b><%=totalrec%></b> &nbsp;This is <%=(page-1)*16+1%>--<%if page+1<=totalpage then%><%=page*16%><%else%><%=totalrec%><%end if%> 
                                      </div></td>
                                  </tr>
                            </table>
                          </div>
                        </td>
                    </tr>
                    <tr> 
                      <td width="575"> 
 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                                    <tr> 
<%i=0
          do while not rs.eof and (i<rs.pagesize)
          i=i+1
 								%>
                                                      <td width="25%" height="134" align="left" bgcolor="#FFFFFF">
														<div align="center">
 <br>
 <table width="95%" border="0" align="right" cellpadding="0" bordercolor="#111111" style="border-collapse: collapse">
                      
                      <tr> 
                        <td align="left" width="114" height="100">
                          <a href="views.asp?hw_id=<%=rs("hw_id")%>">
                            <img border="0" src="<%=rs("hw_pic")%>" width="95" height="134"  style="border: 1px solid #C0C0C0"></a></td>
                        <td align="left" width="403"><b>Title: </b><%=rs("hw_name")%><br>
                          <span style="font-weight: bold">Author: </span><%=rs("hw_sn")%><br>
                          <strong>Price: </strong><font color="#D03430">¥<%=rs("hw_cash")%></font></td>
                      </tr>	<tr> 
                        
                      </tr>
                      </table>
</div>
</td>
<%
		if (i mod 1=0) and i>=1 then
%>
                                                    </tr>
													<tr>
													          <%
	end if
rs.movenext
loop
rs.close
%>
                                                    </tr>
                          </table></td>
                    </tr>
                    <tr> 
                      <td width="575" height="20"> 
                        <div align="center"></div>
                      </td>
                    </tr>
                    <tr> 
                      <td width=575 height="23"> 
                        <p align="center">Page<%=page%>/All Page <%=totalpage%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <%if page-1>0 then%><a href="sort.asp?sort_id=<%=sort_id%>&page=<%=page-1%>&order=<%=order%>">PREVIOUS</a>
                          <%else%>
                          PREVIOUS
                          <%end if%>
                            
                          <%if page+1<=totalpage then%>
                          <a href="sort.asp?sort_id=<%=sort_id%>&amp;page=<%=page+1%>&order=<%=order%>">Next</a> 
                          <%else%>
                          Next
                          <%end if
						  end if%>
                          </font></p>                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>          </td>
        </tr>
      </table></td>
  </tr>
</table>
<!--#include file="tail.asp"-->



vt40

职务:普通成员
等级:2
金币:1.0
发贴:273
#22005/7/29 3:22:20
跳转到几页???有人帮吗?
一页
二页
三页
sort_id=5&page=1
sort_id=5&page=2
sort_id=5&page=3