| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3586 人关注过本帖
标题:asp分页:第一页没问题,但是按别的按钮(首页,下一页等)就会变成搜索全部
只看楼主 加入收藏
aaa8787aaa
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2016-1-11
结帖率:0
收藏
已结贴  问题点数:20 回复次数:6 
asp分页:第一页没问题,但是按别的按钮(首页,下一页等)就会变成搜索全部
" onfocus="this.value=''" onblur="if(!value){value=defaultValue;}">
这是搜索框的代码
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 <% dim bigname,sname
                sqlnews="select * from product where title like '%"&request("keyword")&"%'"
                        
                         set rss=server.CreateObject("adodb.recordset")
                        
                         rss.open sqlnews,conn,3,3
                              set rs=getrecordset(sqlnews)
                             if not ( rs.eof and rs.bof ) then
                             bigname=rs("bigclassname")
                             sname=rs("smallclassname")
                              %>
 这是查询代码        
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
这是分页代码


                        
                            " name="gotopage" class="f12 STYLE2" id="gotopage">
                            <%if rsrecordcount="" then
                                    showcount=0
                                    else
                                    showcount=rsrecordcount
                                    end if
                                    %> 总共有<%=showcount%>张图片
                                    <%
                                     if (rsrecordcount mod rspagesize)=0 then
                                    allpage=int(Cint(rsrecordcount)/rspagesize)
                                    else
                                    allpage=int(Cint(rsrecordcount)/rspagesize)+1
                                    end if
                                    if allpage=0 then
                                    allpage=1
                                    end if
                                    showpages=1
                                    if not isempty(request("page")) then
                                    titlepage=Cint(request("page"))
                                    showpages=Cint(titlepage/rspagesize)+1
                                    end if
                                    if showpages=0 then
                                    showpages=1
                                    end if
                                    %>
                                    第<%=showpages%>/<%=allpage%>页
                            <%if page>=0 then%>
                            ?page=0&bigclassname=<%=request("bigclassname")%>&title=<%=request("keyword")%>">首页
                            <%else%>
                              首页
                              <%end if%>
                                
                          <% if page>1 then %>
                              ?page=<%=page-rspagesize%>&bigclassname=<%=request("bigclassname")%>&title=<%=request("keyword")%>">上页
                              <%else%>
                              上页
                              <%end if%>
                                
                          <% if page
                              ?page=<%=page+rspagesize%>&bigclassname=<%=request("bigclassname")%>&title=<%=request("keyword")%>">下页
                              <%else%>
                              下页
                              <%end if%>
                                
                          <%if page
                              ?page=<%=rspagecount*rspagesize%>&bigclassname=<%=request("bigclassname")%>&title=<%=request("keyword")%>">尾页
                              <%else%>
                              尾页
                          <%end if %>
                              " />" />
   
    <%
    if request("page")<>"" then
    crruectpage=Cint(request("page"))
    %>
      " selected="selected">第<%=Int(crruectpage/rspagesize)+1%>页
     <%end if%>
    <%
    i=0
    do while i
   
     " >第<%=i+1%>页
      <% i=i+1
    loop %>
   
                              
                          
                          
                        
            
搜索更多相关主题的帖子: keyword request product title where 
2016-01-11 16:28
hu9jj
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:红土地
等 级:贵宾
威 望:400
帖 子:11857
专家分:43421
注 册:2006-5-13
收藏
得分:10 

活到老,学到老!http://www.(该域名已经被ISP盗卖了)E-mail:hu-jj@
2016-01-11 18:14
tlliqi
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:204
帖 子:15453
专家分:65956
注 册:2006-4-27
收藏
得分:10 
netlin 的方法可行
2016-01-11 20:59
aaa8787aaa
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2016-1-11
收藏
得分:0 
还是不懂,求大神们帮我修改一下
2016-01-12 17:13
aaa8787aaa
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2016-1-11
收藏
得分:0 
---------------------------------------------------------
<!--#include file="inc/conn.asp"-->
<%
sql="select * from Affiche"
set rss=server.createobject("adodb.recordset")
rss.open sql,conn,1,1
这是链接数据库
-----------------------------------------
2016-01-12 17:15
aaa8787aaa
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2016-1-11
收藏
得分:0 
我从新发一次新的,求大神们帮我改改
-------------------------------------------------------------------------------------------------------------
    <form name="form1" action="shousuo.asp" method="get"><input name="keyword" type="text" class="a" value="" onfocus="this.value=''" onblur="if(!value){value=defaultValue;}" ><input type="submit" name="Submit" value="" class="b" onclick="btn_ck_bh_Click()"></form>
这是搜索框代码
--------------------------------------------------------------------------------------------------------------
<!--#include file="inc/conn.asp"-->
<%
sql="select * from Affiche"
set rss=server.createobject("adodb.recordset")
rss.open sql,conn,1,1
%>
这是数据库连接
-------------------------------------------------------------------------------------------------------
 <%
                dim bigname,sname
                cx = request("keyword")
                sqlnews="select * from product where title like '%"&cx&"%'"
                set rss=server.CreateObject("adodb.recordset")
                rss.open sqlnews,conn,1,3
                set rs=getrecordset(sqlnews)
                if not ( rs.eof and rs.bof ) then
                bigname=rs("bigclassname")
                sname=rs("smallclassname")
                %>               
这是接收和查询代码
---------------------------------------------------------------------------
 <%
        dim j,rspagesize,rspagecount,Page,rsrecordcount
        rspagesize=6
        j=rspagesize
        while not rs.eof
        rs.movenext
        rsrecordcount=rsrecordcount+1
        wend
        rs.movefirst
        rspagecount=int(rsrecordcount/rspagesize)
        Page=int(request("page"))
        if (page<>0) and(Page<=rsrecordcount) then
        rs.move Page
        end if
        %>   
         <tr>
        <%
k=0  
While (j<>0)and(NOT(rs.eof))
%>
<%
 if k<3 then
%>
------------------------------------------------------------------------------------
这里是内容,省略.........
-----------------------------------------------------------------------------------
 <%
k=k+1
j=j-1
rs.MoveNext()
%>   
 <%else
k=0%>
--------------------------------------------------------------------------------------
<%end if %>
                                        <%WEnd%>
                                      
                                   
           <%
        end if
        rs.close
        set rs=nothing
        'call CloseConn

        %>
----------------------------------------------------------------------------------------------
  <%if page>=0 then%>
                            <a href="<%=request.ServerVariables("PATH_INFO")%>?page=0&bigclassname=<%=request("bigclassname")%>&smallclassname=<%=sname%>">首页</a>
                            <%else%>
                              首页
                              <%end if%>
                              &nbsp;&nbsp;
                          <% if page>1 then %>
                              <a href="<%=request.ServerVariables("PATH_INFO")%>?page=<%=page-rspagesize%>&bigclassname=<%=request("bigclassname")%>&smallclassname=<%=sname%>">上页</a>
                              <%else%>
                              上页
                              <%end if%>
                              &nbsp;&nbsp;
                          <% if page<rsrecordcount-rspagesize then %>
                              <a href="<%=request.ServerVariables("PATH_INFO")%>?page=<%=page+rspagesize%>&bigclassname=<%=request("bigclassname")%>&smallclassname=<%=sname%>">下页</a>
                              <%else%>
                              下页
                              <%end if%>
                              &nbsp;&nbsp;
                          <%if page<rsrecordcount-rspagesize then%>
                              <a href="<%=request.ServerVariables("PATH_INFO")%>?page=<%=rspagecount*rspagesize%>&bigclassname=<%=request("bigclassname")%>&smallclassname=<%=sname%>">尾页</a>
                              <%else%>
                              尾页
                          <%end if %></span>
这里是分页代码
----------------------------------------------------------------------------------------------------------------------------------
2016-01-12 17:22
神赐金勋
Rank: 1
来 自:山西大同
等 级:新手上路
帖 子:13
专家分:4
注 册:2015-1-21
收藏
得分:0 
关键得懂分页思想
得多想

!戒娇戒燥!
2016-02-05 21:37
快速回复:asp分页:第一页没问题,但是按别的按钮(首页,下一页等)就会变成搜索全部 ...
数据加载中...
 
   



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

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