| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1000 人关注过本帖
标题:子类分页里goto语句跳转各页,竟然跳到总类分页
只看楼主 加入收藏
魏兴耀
Rank: 8Rank: 8
来 自:江西
等 级:蝙蝠侠
威 望:3
帖 子:246
专家分:840
注 册:2009-11-9
结帖率:94.12%
收藏
已结贴  问题点数:30 回复次数:6 
子类分页里goto语句跳转各页,竟然跳到总类分页
情况是这个样子的,总类下面有3个分类,可图示为:总类(A类、B类、C类),A类有13个产品,B类有5分产品、C类有10个产品,现在每页显示5个产品,点总类的按钮时,有28个产品,那就分6页显示,用goto语句跳转到各个页面是正常的,但是当点点击A类进入A类产品的分页显示时,13个产品,就是显示3页了,用goto语句想跳转到第2页时,跳转到的竟然是总类分页的第二页。
   以下是程序,希望大家帮忙解决一下:
程序代码:
<!-- #include file="Head.asp" -->
<%bigid=request("bigid")
smallid=request("smallid")
if bigid<>"" then
set rs=server.createobject("adodb.recordset")            
rs.open "select * from bigclass where bigclassid="&bigid&"",conn,1,1
bigclassname=rs("bigclassname")
rs.close
end if
if smallid<>"" then
set rs=server.createobject("adodb.recordset")            
rs.open "select * from smallclass where smallclassid="&smallid&"",conn,1,1
smallclassname=rs("smallclassname")
rs.close
end if
%>

<%
'请勿改动下面这二行代码
MaxPerPage=MaxPerPage_Default
strFileName="Product.asp?BigClassName=" & BigClassName & "&SmallClassName=" & SmallClassName
%>

<table width="962" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="491" ><table width="948" border="0" align="center" cellpadding="0" cellspacing="0" height="491">
      <tr>
        <td width="236" valign="top"><!--#include file ="leftp.asp"--></td>
        <td width="720" valign="top" align="right"><table width="99%" border="0" cellspacing="0" cellpadding="0"  style="margin-top:5px">
         
          <tr>
            <td valign="top"><table width="100%" height="315" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="36"><table width="100%" height="36" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="25"><img src="image/productleft.jpg" width="25" height="36"></td>
                      <td width="490" class="productbg">产品展示</td>
                      <td width="162" class="more">当前位置: <A href="/english/index.htm">首页</A> - 产品展示</td>
                      <td width="20"><img src="image/productright.jpg" width="19" height="36"></td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td class="pic" style="padding:10px"  valign="top">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="4%">&nbsp;</td>
              <td width="90%" align="center" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                          <td height="25" style="border:dotted 1px #999; padding:3px"><% call ShowProductTotal() %> <br>
                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                         
  <tr>
  <%
          set rsbigp = server.CreateObject ("adodb.recordset")
             sqlp="select * from BigClass"
             rsbigp.open sqlp,conn,1,1
         if rsbigp.eof and rsbigp.bof then
             Response.Write "暂无记录……"
         else     
         i=1  
             do while not rsbigp.eof
         %>
    <td  id="foot">&nbsp;<a href='Product.asp?Bigid=<%=rsbigp("BigClassid")%>'><%=rsbigp("BigClassName")%></a><% call ShowPTotal(rsbigp("BigClassName")) %></td>
     <%
          if i mod 4=0 then
          response.Write("</tr><tr>")
          end if
          i=i+1
          rsbigp.movenext
          loop
          rsbigp.close
          set rsbigp=nothing
           end if%>
  </tr>
</table>
</td>
                        </tr>
                  <%
                   
page=clng(request("page"))        
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from Products where Passed=True "
    if BigClassName<>"" then
        sql=sql & " and BigClassName='" & BigClassName & "' "
        end if
        if SmallClassName<>"" then
            sql=sql & " and SmallClassName='" & SmallClassName & "'"
    end if
    sql=sql  &"order by id asc"
    rs.open sql,conn,1,1
i=0
if rs.eof and rs.bof then
  response.Write("暂时没有记录")
else
%>
                  <%
               
rs.PageSize=12
if page=0 then page=1
pages=rs.pagecount
if page > pages then page=pages
rs.AbsolutePage=page 
%>
                  <tr>
                    <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:5px">
                       
                        <tr>
                          <%for j=1 to rs.PageSize
           
             %>
                          <td height="160"><table border="0" align="center" cellpadding="0" cellspacing="0"  width="170">
                              <tr>
                                <td align="center" valign="middle" style="background:url(image/movebg.jpg) no-repeat; width:152px; height:152px"><a href="ProductShow.asp?ID=<%= RS("ID") %>" target="_blank"><img src='<%= RS("DefaultPicUrl") %>' border=0 alt='产品展示' width="130" height="130"></a></td>
                              </tr>
                              <tr>
                                <td height="23" ><br>
                                    <table width="100%" height="23" border="0" cellpadding="0" cellspacing="0" background="Images/chanpin.jpg">
                                      <tr>
                                        <td align="center"><a href="ProductShow.asp?ID=<%= RS("ID") %>" target="_blank"><strong><font color="#2C6995"><%=RS("title") %></font></strong></a></td>
                                      </tr>
                                  </table></td>
                              </tr>
                            </table>
                              <br></td>
                          <%   i=i+1
                 if i mod 4=0 then
                 response.Write("</tr>")
                  end if
               
                   %>
                          <%
rs.movenext
if rs.eof then exit for
next
%>
                              </table></td>
                  </tr>
                  <tr valign="bottom">
                    <td height="50" colspan="2" align="center" ><form method=Post action="product.asp">
                        <%if Page<2 then     
    response.write "首页 上一页&nbsp;"
  else
    response.write "<a href=product.asp?Bigid="&Bigid&"&smallid="&smallid&"&page=1>首页</a>&nbsp;"
    response.write "<a href=product.asp?Bigid="&Bigid&"&smallid="&smallid&"&page=" & Page-1 & ">上一页</a>&nbsp;"
  end if
  if rs.pagecount-page<1 then
    response.write "下一页 尾页"
  else
    response.write "<a href=product.asp?Bigid="&Bigid&"&smallid="&smallid&"&page=" & (page+1) & ">"
    response.write "下一页</a> <a href=product.asp?Bigid="&Bigid&"&smallid="&smallid&"&page="&rs.pagecount&">尾页</a>"
  end if
   response.write "&nbsp;页次:<strong><font color=red>"&Page&"</font>/"&rs.pagecount&"</strong>页 "
    response.write "&nbsp;共<b><font color='#FF0000'>"&rs.recordcount&"</font></b>条记录 <b>"&rs.pagesize&"</b>条记录/页"
   response.write " 转到:<input type='text' name='page' size=4 maxlength=10 class=input value="&page&">"
   response.write " <input class=input type='submit'  value=' Goto '  name='cndok'></span></p>"    
%>
                    </form></td>
                  </tr>
                  <%
end if
rs.close
set rs=nothing
%>
              </table></td>
              <td width="6%">&nbsp;</td>
            </tr>
          </table></td>
              </tr>
              <tr>
                <td height="9"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="9">
                    <tr>
                      <td width="8" style="background: url(image/bleft.jpg) no-repeat"></td>
                      <td style="background: url(image/bbg.jpg) repeat-x">&nbsp;</td>
                      <td width="8" style="background: url(image/bright.jpg) no-repeat"></td>
                    </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>

 
</table>
<!-- #include file="Inc/Foot.asp" -->
</BODY></HTML>

 
搜索更多相关主题的帖子: goto 子类 语句 
2010-11-07 12:57
魏兴耀
Rank: 8Rank: 8
来 自:江西
等 级:蝙蝠侠
威 望:3
帖 子:246
专家分:840
注 册:2009-11-9
收藏
得分:0 
我觉得应该要再加上一个条件语句,但是现在不晓得要怎么办了

只有大胆尝试,才有机会得到想要的成功
2010-11-07 13:00
魏兴耀
Rank: 8Rank: 8
来 自:江西
等 级:蝙蝠侠
威 望:3
帖 子:246
专家分:840
注 册:2009-11-9
收藏
得分:0 
以上程序是每页显示12个产品的,我前面说的总类,A、B、C,是为方便理解类似解说的

只有大胆尝试,才有机会得到想要的成功
2010-11-07 13:02
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:30 
Response.Write sql看看
2010-11-08 10:37
魏兴耀
Rank: 8Rank: 8
来 自:江西
等 级:蝙蝠侠
威 望:3
帖 子:246
专家分:840
注 册:2009-11-9
收藏
得分:0 
回复 4楼 aspic
弹出的语句是对的

只有大胆尝试,才有机会得到想要的成功
2010-11-09 21:26
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:0 
因为你的goto提交表单的时候没有把类别的参数一起提交过去
而是提交到product.asp
应该是product.asp?Bigid=<%=Bigid%>&smallid=<%=smallid%>
2010-11-10 09:02
魏兴耀
Rank: 8Rank: 8
来 自:江西
等 级:蝙蝠侠
威 望:3
帖 子:246
专家分:840
注 册:2009-11-9
收藏
得分:0 
回复 6楼 aspic
我试过了,还是没用的

只有大胆尝试,才有机会得到想要的成功
2010-11-12 00:00
快速回复:子类分页里goto语句跳转各页,竟然跳到总类分页
数据加载中...
 
   



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

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