| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 731 人关注过本帖
标题:分页程序中的跳转问题
只看楼主 加入收藏
jingjing316
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:1
帖 子:293
专家分:541
注 册:2009-8-11
结帖率:92.31%
收藏
已结贴  问题点数:20 回复次数:5 
分页程序中的跳转问题
<a HREF="<%=Myself%>?Page=<%=rs.PageCount%>&subjectview=<%=subjectview%>&typeadd=<%=typeadd%>&mykey=<%=mykey%>">
        最后一页</a> <% End If %> <font SIZE="2">输入页次:</font><input NAME="Page" SIZE="3" CLASS="s01">
        <font SIZE="2">页次:</font><font COLOR="Red" SIZE="2"><%=Page%>/<%=rs.PageCount%></font></p>
在红色字段添个什么,能够使输入页码回车后,跳转到对应的页。
搜索更多相关主题的帖子: 能够 
2009-10-14 09:30
lele2007
Rank: 5Rank: 5
来 自:广东省深圳
等 级:职业侠客
威 望:6
帖 子:1028
专家分:305
注 册:2007-9-4
收藏
得分:5 
<font SIZE="2">输入页次:</font><input NAME="Page" SIZE="3" CLASS="s01" id="lele"><input type="button" value="跳转"   
onclick="location.href='<%=Myself%>?Page='+getElementById('lele').value;">


这样试一下。。
我没得测试

学习编程www.
2009-10-14 09:53
孤独冷雨
Rank: 10Rank: 10Rank: 10
来 自:安徽滁州
等 级:贵宾
威 望:23
帖 子:1247
专家分:1909
注 册:2007-6-4
收藏
得分:5 
给你个下拉框选择跳转页,我用的基本上都这个。
自己把里面代码整理出来:
<html xmlns="http://www.
<head>
<%Server.ScriptTimeout=9999%>
<!-- #include file="../inc/guest_constsql.asp" -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=qbx_title%></title>
<link href="../css/styls.css" rel="stylesheet" type="text/css">
<script language="javascript">
function pageii(i){
document.gopage.currentpage.value=i;
document.gopage.submit();
}
</script>
</head>
 
<body>
<!--#include file="../inc/head.asp"-->
<table width="995" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="229" align="center" valign="top"><table width="229" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="29" background="../img/left1.jpg" style="font-size:13px; font-weight:bold;">&nbsp;&nbsp;&nbsp;&nbsp;推荐供求信息</td>
      </tr>
      <tr>
        <td height="195" align="center" valign="top" background="../img/left2.jpg">
         
        <table width="220" border="0" cellspacing="0" cellpadding="0">
        <%  
        set rs=server.createobject("adodb.recordset")
        sql="select * from trade where check=true and (trade_sort=0 or trade_sort=1) and trade_show=true order by edit_time  desc ,addtime desc"
        rs.open sql,conn,1,1
        if rs.eof then
        response.write "<tr><td  height='30' align='center'>暂无内容</td></tr>"
        else
        for i=1 to 7
         %>
          <tr>
            <td width="45" height="27" align="center">[<%
            if rs("trade_sort")=0 then
            response.write "<span style='color:#00f'>供应</span>"
            elseif rs("trade_sort")=1 then
            response.write "<span style='color:#f00'>求购</span>"
            
            end if
            %>]</td>
            <td width="175" height="27" align="left" valign="middle"><%if rs("trade_sort")=0 then%>
        <a href="../com_show/provide_show_one.asp?trade_id=<%=rs("trade_id")%>&com_id=<%=rs("com_id")%>" target="_blank">
        <%else%>
        <a href="../com_show/wanted_show_one.asp?trade_id=<%=rs("trade_id")%>&com_id=<%=rs("com_id")%>" target="_blank">
        <%end if%><%
                    if len(trim(rs("trade_title")))>13 then
                    response.Write left(rs("trade_title"),12)&"…"
                    else
                    response.Write rs("trade_title")
                    end if
                     
                    %></a></td>
          </tr>
          <% rs.movenext
          if rs.eof then exit for
          next
          end if
          rs.close
          set rs=nothing
           %>
        </table>
         
         
         
        </td>
      </tr>
      <tr>
        <td height="1" bgcolor="#B0780B"></td>
      </tr>
    </table>
  
 <table width="229" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="5"></td>
  </tr>
</table>
    <!--#include file="../inc/index_left.asp"-->
     
    </td>
    <td width="6" align="center" valign="top"></td>
    <td width="539" align="center" valign="top"><table width="539" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="29" align="center" background="../img/mid1.jpg"><table width="530" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="382" height="29">&nbsp;&nbsp;&nbsp;&nbsp;首页 >> 商机  
              <%
        trade_sort=trim(request("trade_sort"))+""
         
         
        if trade_sort="0" then
            response.write "> 供应"
            elseif trade_sort="1" then
            response.write "> 求购"
     
            end if
         
        %></td>
            <td width="148" align="center" valign="middle"><a href="index.asp?trade_sort=1">求购</a><span style="padding-top:5px; color:#333; font-size:8px;"> ■ </span><a href="index.asp?trade_sort=0">供应</a></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="1000" align="center" valign="top" background="../img/mid2.jpg">
         
         
        <table width="539" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="1055" align="center" valign="top">
    <table width="530" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="5" ></td>
  </tr>
</table>
 
     
     
     
    <table width="530" border="0" cellspacing="0" cellpadding="0">
    <%   
    if trade_sort="0" then
    Set rs= Server.CreateObject("ADODB.Recordset")                                             
sql="select * from trade where check=true and trade_sort=0 order by edit_time  desc ,addtime desc"
%>
      <tr>
        <td height="30" colspan="2" bgcolor="#E8E8E8" style="font-size:13px; font-weight:bold;">&nbsp;&nbsp;&nbsp;供 应</td>
        </tr>
        <% end if %>
         
          <%   
    if trade_sort="1" then
    Set rs= Server.CreateObject("ADODB.Recordset")                                             
sql="select * from trade where check=true and trade_sort=1 order by edit_time  desc ,addtime desc"
    %>
         
      <tr>
        <td height="30" colspan="2" bgcolor="#E8E8E8" style="font-size:13px; font-weight:bold;">&nbsp;&nbsp;&nbsp;求 购</td>
        </tr>
          <%
          end if
          if trade_sort="" then
          Set rs= Server.CreateObject("ADODB.Recordset")                                    
sql="select * from trade where check=true and (trade_sort=1 or trade_sort=0) order by edit_time  desc ,addtime desc"
           end if  
      
        rs.open sql,conn,1,1      
 
 if rs.eof then
     rs.close  
    response.write "<tr><td>&nbsp;&nbsp;还没有记录!</td></tr>"  
   
   else
const maxperpage=33'定义每一页显示的数据记录的常量
dim currentpage '定义当前页的变量
rs.pagesize=maxperpage
currentpage=request("currentpage")
if currentpage="" or not Isnumeric(currentpage) then
currentpage=1
elseif currentpage<1 then
currentpage=1
else
currentpage=clng(currentpage)
    if currentpage > rs.pagecount then
    currentpage=rs.pagecount
    end if
end if
'如果变量c1urrentpage的数据类型不是数值型
'就1赋给变量c1urrentpage
if not isnumeric(currentpage) then
currentpage=1
end if
dim totalput,n '定义变量
totalput=rs.recordcount
if totalput mod maxperpage=0 then
n=totalput\maxperpage
else
n=totalput\maxperpage+1
end if
if n=0 then
n=1
end if
rs.move(currentpage-1)*maxperpage
i=0
 do while i< maxperpage and not rs.eof
 
%>
     
      <tr>
        <td width="440" height="30" align="left" valign="middle">&nbsp;<img src="../index/images/b.jpg" width="4" height="6">&nbsp;[<%
        if rs("trade_sort")=0 then
        response.write "<span style='color:#00f'>供应</span>"
        else
        response.write "<span style='color:#f00'>求购</span>"
        end if
        %>]&nbsp;
        <%if rs("trade_sort")=0 then%>
        <a href="../com_show/provide_show_one.asp?trade_id=<%=rs("trade_id")%>&com_id=<%=rs("com_id")%>" target="_blank">
        <%else%>
        <a href="../com_show/wanted_show_one.asp?trade_id=<%=rs("trade_id")%>&com_id=<%=rs("com_id")%>" target="_blank">
        <%end if%>
        <%if len(rs("trade_title"))>30 then
        response.write left(rs("trade_title"),28)&"…"
        else
        response.write rs("trade_title")
        end if
        %></a></td>
        <td width="90" height="30" align="center"><%=rs("addtime")%></td>
      </tr>
      <tr>
        <td height="1" colspan="2" background="../img/line.jpg"></td>
        </tr>
         <%
  i=i+1
  rs.movenext
  loop
  rs.close
  end if
  %>
    </table>
    </td>
  </tr>
  <tr>
    <td height="53" align="center" valign="middle">
     
<table width="511" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
    <td width="371">
    共有<%=totalput%>条信息   
       <% k=currentpage                     
       if k<>1 then%>
       [<a class="link" href="javascript:pageii(1);">首页</a>]                     
       [<a class="link" href="javascript:pageii(<%=k-1%>);">上一页</a>]                     
       <%else%>
       [首页]&nbsp;[上一页]                     
       <%end if%>
       <%if k<>n then%>                     
       [<a class="link" href="javascript:pageii(<%=k+1%>);">下一页</a>]                     
       [<a class="link" href="javascript:pageii(<%=n%>);">尾页</a>]                     
       <%else%>
       [下一页]&nbsp;[尾页]                     
       <%end if%>
       页次:<%=currentpage%>/<% =n%>      </td>  
    <form action="" method="post" name="pag" style="margin:0px;">
        
            <td width="140" height="23"> <p>转到:  
                <select onChange="javascript:pageii(document.pag.pag.value)" size="1" id="pag" name="pag" style="background-attachment: scroll; background-repeat: repeat; font-size: 9pt; height: 23; width: 96; background-color: #FFFFFF; border: 1 solid #000000; background-position: none 0%; width:70px;">
                  <%
          i=1
          do while not i > n
          %>
                  <option value="<%=I%>" <%if i=currentpage then %>selected<%end if%>>第  
                  <%=i%> 页</option>
                  <%
          i=i+1
          loop
          %>
                </select>
            </td>
          </form>
        <TR>
        </TR>
    </table>
    <form action="" method="post" name="gopage" style="margin:0px;">
<input type="hidden" name="currentpage" value="">
<input type="hidden" name="id" value="<%=id%>">
</form>
     
    </td>
  </tr>
</table>
 
         
         
        </td>
      </tr>
      <tr>
        <td height="1" bgcolor="#BD8A2E"></td>
      </tr>
    </table></td>
    <td width="6" align="center" valign="top"></td>
    <td width="215" align="center" valign="top">
    <table width="215" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="1" bgcolor="#CCCCCC"></td>
      </tr>
      <tr>
        <td height="220" align="center" background="../img/right1.jpg"><img src="../img/right1_1.jpg" width="207" height="214"></td>
      </tr>
      <tr>
        <td height="1" bgcolor="#CCCCCC"></td>
      </tr>
    </table>
    <table width="215" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="10"></td>
      </tr>
      <tr>
        <td height="36" background="../img/right2.jpg">&nbsp;</td>
      </tr>
      <tr>
        <td height="240" align="center" valign="top" background="../img/right1.jpg">
        <table width="210" border="0" cellspacing="0" cellpadding="0">
             <% set rs=server.createobject("adodb.recordset")
      sql="select * from news where cateid=1 and (second_cateid=40 or second_cateid=41 or second_cateid=42) order by id desc"
       rs.open sql,conn,1,1
       if rs.eof then
       response.write "<tr><td>&nbsp;&nbsp;还没有记录!</td></tr>"  
       else
       for i=1 to 9
        %>
          <tr>
            <td width="20" height="26" align="center"><img src="../index/images/b.jpg" width="4" height="6"></td>
            <td width="190" height="26" align="left"><a href="../zx/new_show.asp?id=<%=rs("id")%>" target="_blank"><%
                    if len(trim(rs("title")))>14 then
                    response.Write left(rs("title"),12)&"…"
                    else
                    response.Write rs("title")
                    end if
                     
                    %></a></td>
          </tr>
          <%rs.movenext
          if rs.eof then exit for
          next
          end if
          rs.close
          set rs=nothing
          %>
        </table>
        </td>
      </tr>
      <tr>
        <td height="1" bgcolor="#CCCCCC"></td>
      </tr>
    </table>
    <table width="215" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="5"></td>
      </tr>
      <tr>
        <td height="70"><img src="../img/right3.jpg" width="215" height="60"></td>
      </tr>
      <tr>
        <td height="70"><img src="../img/right4.jpg" width="215" height="60"></td>
      </tr>
      <tr>
        <td height="5"></td>
      </tr>
    </table>
       <!--#include file="../inc/bbsGoodTopic.asp"-->
    </td>
  </tr>
</table>
 
<!--#include file="../inc/foot.asp"-->
 
</body>
</html>

这里有男女系列成人用品,有时间兄弟们来看一看.
51za.
2009-10-14 09:54
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:5 
一般加个表单
2009-10-14 10:04
jingjing316
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:1
帖 子:293
专家分:541
注 册:2009-8-11
收藏
得分:0 
谢谢各位!我很困惑,下面两段程序有什么区别吗?为什么第一段可以实现跳转,第二段就不行呢?请不吝赐教!主要截取了有关页面跳转的,不是很完整。

程序段一:
<table style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0" width="520">
    <form ACTION="<%=Myself%>?subjectview=<%=nianji%>&banji=<%=banji%>&mykey=<%=mykey%>%&gt;" METHOD="GET">
      <tr>
        <td>
        <p ALIGN="right">  <input type=checkbox name=del_all1 value=1 onclick=FanAll(viewaddform)>全选<span lang="en-us"> </span>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT  class="s02" onclick="window.location='adminsomething.asp'" type=button value=返回 name=close><span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><%If Page <> 1 Then ' 如果不是位于第一页%>
        <a href="<%=Myself%>?Page=1&subjectview=<%=nianji%>&banji=<%=banji%>&mykey=<%=mykey%>">
        第一页</a>
        <a HREF="<%=Myself%>?Page=<%=(Page-1)%>&subjectview=<%=nianji%>&banji=<%=banji%>&mykey=<%=mykey%>">
        上一页</a>
        <%                                       
End If   
                              
If Page <> rs.PageCount Then ' 如果不是位于最后一页                                          
%> <a HREF="<%=Myself%>?Page=<%=(Page+1)%>&subjectview=<%=nianji%>&banji=<%=banji%>&mykey=<%=mykey%>">
        下一页</a>
        <a HREF="<%=Myself%>?Page=<%=rs.PageCount%>&subjectview=<%=nianji%>&banji=<%=banji%>&mykey=<%=mykey%>">
        最后一页</a> <% End If %> <font SIZE="2">输入页次:</font><input NAME="Page" SIZE="3" CLASS="s01">
        <font SIZE="2">页次:</font><font COLOR="Red" SIZE="2"><%=Page%>/<%=rs.PageCount%></font></p>
        <p> </td>
      </tr>
    </form>
  </table>
   
  </div>
   
  <%end if      
程序段二:
 <div ALIGN="right">
  <table>
    <form ACTION="<%=Myself%>?subjectview=<%=subjectview%>&typeadd=<%=typeadd%>&mykey=<%=mykey%>" METHOD="GET">
      <tr>
        <td>
        <p ALIGN="right">  <input type=checkbox name=del_all1 value=1 onclick=FanAll(viewaddform)>全选<span lang="en-us"> </span>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%If Page <> 1 Then ' 如果不是位于第一页%>
        <a href="<%=Myself%>?Page=1&subjectview=<%=subjectview%>&typeadd=<%=typeadd%>&mykey=<%=mykey%>">
        第一页</a>
        <a HREF="<%=Myself%>?Page=<%=(Page-1)%>&subjectview=<%=subjectview%>&typeadd=<%=typeadd%>&mykey=<%=mykey%>">
        上一页</a>
        <%                                       
End If   
                              
If Page <> rs.PageCount Then ' 如果不是位于最后一页                                          
%> <a HREF="<%=Myself%>?Page=<%=(Page+1)%>&subjectview=<%=subjectview%>&typeadd=<%=typeadd%>&mykey=<%=mykey%>">
        下一页</a>
        <a HREF="<%=Myself%>?Page=<%=rs.PageCount%>&subjectview=<%=subjectview%>&typeadd=<%=typeadd%>&mykey=<%=mykey%>">
        最后一页</a> <% End If %> <font SIZE="2">输入页次:</font><input NAME="Page" SIZE="3" CLASS="s01">
        <font SIZE="2">页次:</font><font COLOR="Red" SIZE="2"><%=Page%>/<%=rs.PageCount%></font></p>
        <p> </td>
      </tr>
    </form>
  </table>
   
  <%end if         
   
  
   
  %></div>
2009-10-14 16:16
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:5 
跳转是在客户端Javascript代码来控制的,不是<%%>内的代码来控制的。
2009-10-14 16:23
快速回复:分页程序中的跳转问题
数据加载中...
 
   



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

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