回 帖 发 新 帖 刷新版面

主题:两问题,希望高手帮助分析一下,谢谢!

问题一:
为什么全选点了没有反应?
问题二:
虽然分了页,但是总是显示第一页,点第二页也不挑转.

麻烦高手指点一下,万分谢谢!

代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #include file="conn.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>管理员界面</title>
<style type="text/css">
<!--
.STYLE1 {
    font-size: 36px;
    font-weight: bold;
    font-family: "楷体_GB2312";
}
a:link
{
color:#000000; text-decoration:none;
}
a:active
{
color:#000000; text-decoration:none;
}
a:visited{
    color:#000000; 
    text-decoration:none; 
}
a:hover{
    color: #00CC00;
    text-decoration:none
}
-->
</style>
</head>
<body bgcolor="#008080">
<P align="center"><img src="image/TOP.jpg" /></P>
<%
if session("mode")=no then
response.Write("<script>alert('请你先登陆!');onclick=(location='index.asp');</script>")
end if 

%>
<span class="STYLE1"><div align="center">管理界面</div></span>
<table width="200">
  <tr>
    <td align="center"><a href="usermanager.asp">人员管理</a></td>
  </tr>
  <tr>
    <td align="center">记录管理</td>
  </tr>
</table>
<table width="780" align="center" border="1" cellpadding="0" cellspacing="0" bordercolor="#666666">
  <tr>
    <td align="center">选择</td>
    <td align="center">学号</td>
    <td align="center">记录标题</td>
    <td align="center">提交时间</td>
    <td align="center">下载</td> 
  </tr>
<%
set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from content order by id desc"
rs.open sqlstr,conn,1,1
if rs.eof or rs.bof then 
 response.Write("<script> alert('没有记录');location.href='add.asp';</script>")
else
  counts=15
  rs.pagesize=counts
  allpages=rs.pagecount
  page=request.QueryString("page")
  if isempty(page) or cint(page) then 
     page=1
  elseif cint(page)>=allpages then 
     page=allpages
  end if 
     rs.absolutepage=page
  do while(not rs.eof) and counts>0
%>
  <tr>
    <td align="center" width="5%"><input name="check" type="checkbox" /></td>
    <td align="center" width="5%"><%=rs("xh")%></td>
    <td align="center" width="65%"><a href="mshow.asp?id=<%=rs("id")%>"><%=rs("title")%></a></td>
    <td align="center" width="20%"><%=rs("time")%></td>
    <td align="center" width="5%"><a href="download/<%=rs("id")%>.doc"><img src="image/home04.jpg" width="16" height="16"/></a></td>
  </tr>
<% 
   counts=counts-1
   rs.movenext
   if rs.eof then exit do
   loop
end if
%>
   <tr>
     <td colspan="3">共有<%=rs.recordcount%>条记录</td>
     <td colspan="2">
<%
    for j=1 to rs.pagecount
    response.Write("<a href='lwmanager.asp?page="&j&"'>["&j&"]</a>")
    next
    rs.close
    set rs=nothing
%>     
     </td>
   </tr>
</table>
</body>
</html>

回复列表 (共7个回复)

沙发

介绍一个分页
http://www.programfan.com/blog/article.asp?id=15045

板凳

什么123?麻烦只点一下!

3 楼

那个分页和我这个分页,只是循环不同吧?好象都是用到recordset集,形式不一样,原理一样吧.

4 楼

是的,只是你的写法有点麻烦,这是我帮你改过的,你试试
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #include file="conn.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>管理员界面</title>
<style type="text/css">
<!--
.STYLE1 {
    font-size: 36px;
    font-weight: bold;
    font-family: "楷体_GB2312";
}
a:link
{
color:#000000; text-decoration:none;
}
a:active
{
color:#000000; text-decoration:none;
}
a:visited{
    color:#000000; 
    text-decoration:none; 
}
a:hover{
    color: #00CC00;
    text-decoration:none
}
-->
</style>
</head>
<body bgcolor="#008080">
<P align="center"><img src="image/TOP.jpg" /></P>
<%
if session("mode")=no then
response.Write("<script>alert('请你先登陆!');onclick=(location='index.asp');</script>")
end if 

%>
<span class="STYLE1"><div align="center">管理界面</div></span>
<table width="200">
  <tr>
    <td align="center"><a href="usermanager.asp">人员管理</a></td>
  </tr>
  <tr>
    <td align="center">记录管理</td>
  </tr>
</table>
<table width="780" align="center" border="1" cellpadding="0" cellspacing="0" bordercolor="#666666">
  <tr>
    <td align="center">选择</td>
    <td align="center">学号</td>
    <td align="center">记录标题</td>
    <td align="center">提交时间</td>
    <td align="center">下载</td> 
  </tr>
<%
set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from content order by id desc"
rs.open sqlstr,conn,1,1
if rs.eof or rs.bof then 
 response.Write("<script> alert('没有记录');location.href='add.asp';</script>")
else
  rs.pagesize=15
  page=clng(Request("page"))
  if page<1 then page=1
  if page>rs.pagecount then page=rs.pagecount
  rs.AbsolutePage = page
  for i=1 to rs.pagesize
%>
  <tr>
    <td align="center" width="5%"><input name="check" type="checkbox" /></td>
    <td align="center" width="5%"><%=rs("xh")%></td>
    <td align="center" width="65%"><a href="mshow.asp?id=<%=rs("id")%>"><%=rs("title")%></a></td>
    <td align="center" width="20%"><%=rs("time")%></td>
    <td align="center" width="5%"><a href="download/<%=rs("id")%>.doc"><img src="image/home04.jpg" width="16" height="16"/></a></td>
  </tr>
<% 
    rs.movenext
    If rs.EOF Then
       Exit For
    End If
    next
end if
%>
   <tr>
     <td colspan="3">共有<%=rs.recordcount%>条记录</td>
     <td colspan="2">
<%
    for j=1 to rs.pagecount
    response.Write("<a href='lwmanager.asp?page="&j&"'>["&j&"]</a>")
    next
    rs.close
    set rs=nothing
%>     
     </td>
   </tr>
</table>
</body>
</html>

5 楼

恩,首先谢谢你!
但是我用那个循环在其他页面依然能分页可是这个就不行了,我对比了半天,还是没发现问题出在那!

6 楼

do while(not rs.eof) and counts>0
去掉这里面的 and counts>0和下面的counts=counts-1
试试

7 楼

你好,已经试过了,那两个是控制显示,去掉了,虽然也分页,但是就全部一次行在第一页显示出来啦!

我来回复

您尚未登录,请登录后再回复。点此登录或注册