标题:图片记录集分页显示的问题
取消只看楼主
tepnidh
Rank: 2
等 级:论坛游民
帖 子:192
专家分:24
注 册:2009-8-2
结帖率:87.5%
已结贴  问题点数:20 回复次数:1 
图片记录集分页显示的问题


问题描述:做图片后台管理,添加,修改,删除操作都正常.唯独在给记录集分页显示时出现问题.如:数据表中添加了18张图片的记录,在hbjymfy.js(分页)中设置每页显示15张,结果是18张图片分了2页(hbjfyxs.js分页显示),第1页显示了18张,第2页显示了8张,这样分2页共计26张,与数据表中记录的数字不符.我试了很多次,当添加的图片比较多时,分的页数也比较多,但无论怎样分,第1页显示的是图片的总数量,依次每页逐渐减少,不知是什么原因,请各位老师多多指点!谢谢!

[附后台图片编辑(dmxx-hbj.asp),分页部分(hbjymfy.js),分页显示(hbjfyxs.js)代码]
dmxx-hbj.asp:
<!--#include file="../conn.asp" -->
<%
Set rs = Server.CreateObject ("ADODB.Recordset")
sql = "Select * from dmxx  ORDER BY id DESC"
rs.Open sql,conn,1,1
%>
<!--#include file="hbjymfy.js" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE2 {
    font-size: 24px;
    font-weight: bold;
    color: #0000FF;
}
.STYLE3 {font-size: 12px}
a:link {
    text-decoration: none;
}
a:visited {
    text-decoration: none;
}
a:hover {
    text-decoration: none;
}
a:active {
    text-decoration: none;
}
.STYLE5 {font-size: 16px}
-->
</style>
<style type="text/css">
<!--
.cf {
 float: left;
}
.STYLE6 {color: #FF0000}
-->
</style>
</head>

<body>
<table width="780" border="1" cellspacing="0" cellpadding="0">
  <tr>
   <td height="40" colspan="2" align="center" bgcolor="#00FFFF"><span class="STYLE2">图片  后 台 编 辑</span></td>
  </tr>
  <tr>
    <td width="580" height="30" align="center" class="STYLE5">[
     <%
        if not rs.eof then%>
           <a href="dmxx-htj.asp?id=<% =rs("id")%>"><strong>添&nbsp; 加</strong></a>
        <%else%>
           <a href="dmxx-htj.asp"><strong>添&nbsp; 加</strong></a>
      <% end if%>
    ] </td>
    <td width="200" align="center" class="STYLE5"><span class="STYLE3">当前共有<span class="STYLE6">&nbsp; <%=rs.recordcount%>&nbsp;</span> 张图片 </span></td>
  </tr>
  <tr>
    <td height="25" colspan="2" align="left">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
   
          <td align="center" valign="top"><p><span class="STYLE25"><span class="px16"></span></span></p>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
            </table>
            <%
if rs.EOF and rs.BOF then
response.write"暂时无图片"
else
Do Until rs.EOF %>
            <table width="140" height="150" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC" class="cf">
            
  <tr>
                <td height="90" colspan="2" align="center">
<img src=<%=rs("pic")%>  width="120" height="90" border="0" style="cursor:pointer;BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 8px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 8px; PADDING-BOTTOM: 8px; BORDER-LEFT: #cccccc 1px solid; PADDING-TOP: 8px; BORDER-BOTTOM: #cccccc 1px solid;"></td>
          </tr>
    <tr>
     <td  height="30" colspan="2" align="center"><%=rs("bt")%></td>
    </tr>
              <tr>
                <td width="70"  height="25" align="center" class="STYLE3"><span class="STYLE1"><a href="dmxx-hxg.asp?id=<%= rs ("id") %>">修&nbsp; 改</a></span></td>
                <td width="70" align="center" class="STYLE3"><a href="dmxx-hsc.asp?id=<%= rs("id") %>">删&nbsp; 除</a></td>
              </tr>
            </table>  
            
<% rs.MoveNext
Loop
end if
%>
            </table ></td>
  </tr>
</table>
<table width="780" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"><!--#include file="hbjfyxs.js" -->
</td>
  </tr>
</table>
</td>
  </tr>
</table>
</body>
</html>
<% conn.close         
set conn=nothing   
%>

hbjymfy.js

<!--分页部分:-->
<%
rs.PageSize =15'//(Yoko:这里设定每页显示的记录数
     pre = true
      last = true
      page = trim(Request.QueryString("page"))
      
      if len(page) = 0 then
                  intpage = 1
                  pre = false
      else
          if cint(page) =< 1 then
               intpage = 1
               pre = false
          else
              if cint(page) >= rs.PageCount then
                  intpage = rs.PageCount
                  last = false
              else
                   intpage = cint(page)
             end if
         end if
      end if
    if not rs.eof then
         rs.AbsolutePage = intpage
    end if
%>

hbjfyxs.js

<!--分页显示部分:-->
<table width="100%" border="0" >
   <tr>
     <%if rs.pagecount > 0 then%>
     <td width="13%" align="center" class="STYLE3">当前是<%=intpage%>页 / 共有<%=rs.PageCount%>页</td>
     <%else%>
    <td width="41%" align="center" class="STYLE3">当前页0/0</td><%end if%>
    <td width="46%" align="right" class="STYLE3"> <a href="dmxx-hbj.asp?page=1">首页</a>|
     <%if pre=true then%>
     <a href="dmxx-hbj.asp?id=<%=request.querystring("id")%>&page=<%=intpage -1%>">上页</a>| <%end if%>
     <%if last then%>
      <a href="dmxx-hbj.asp?id=<%=request.querystring("id")%>&page=<%=intpage +1%>">下页</a> |<%end if%>
      <a href="dmxx-hbj.asp?id=<%=request.querystring("id")%>&page=<%=rs.PageCount%>">尾页</a>| 转到第
      <select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
      <%
       for i = 1 to rs.PageCount
       if i = intpage then%>
       <option value="dmxx-hbj.asp?page=<%=i%>" selected><%=i%></option>
     <%else%>
       <option value="dmxx-hbj.asp?page=<%=i%>"><%=i%></option>
        <%
          end if
        next
        %>
     </select>页</font>
    </td>
   </tr>
 </table>
搜索更多相关主题的帖子: 记录 后台管理 数据表 图片 
2012-02-20 08:15
tepnidh
Rank: 2
等 级:论坛游民
帖 子:192
专家分:24
注 册:2009-8-2
得分:0 
回复 2楼 yms123
谢谢yms123老师,在您的指点下,问题已解决!实在感谢您!
2012-02-20 15:13



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




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

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