北京网站建设

宏道企业管理系统的留言板回复的修改

用宏道的系统做了个网站,,留言貌似不完善,只是显示第一条。。后面全不显示了

 

源代码:

<!--#include file="Inc/conn.asp" -->

<script language="javascript">
<!--
function winopen(url)
{
window.open(url,"search","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width=640,height=450,top=200,left=100");
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<script>
function eshop(id) { window.open("Eshop.asp?cpbm="+id,"","height=400,width=640,left=200,top=0,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");}
</script>
<%If Session("UserName")="" Then
response.redirect"userhome.asp"
end if%>
<%
Id=Session("UserName")
set Rst = Server.CreateObject("ADODB.recordset")
sql="select * from User where UserName='"&Id&"'"
rst.open sql,conn,1,1
%>
<%


name=Session("UserName")
set rs=server.createobject("adodb.recordset")
sql="select * from book where name='"&name&"' or name='管理员' order by id desc"
rs.open sql,conn,1,1

'取得页数,并判断留言输入的是否数字类型的数据,如不是将以第一页显示
dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next

If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if

call list

'显示帖子的子程序
Sub list()%>
<table width="89%" height="19" border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:#060; font-size:12px">
                                  <tr class="top_m_txt01">
                                    <td width="21%" height="18" bgcolor="#eeeeee"><img src="img/arrow.gif" width="16" height="13"><strong>留言列表</strong></td>
                                    <td width="79%" bgcolor="#eeeeee"><%Response.write "<strong><font color='#000000'>-> 全部-</font>"
Response.write "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>条留言</font></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
Response.write "<strong><font color='#000000'>第</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) &  "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font></strong>&nbsp;"
If currentpage > 1 Then
response.write "<strong><a href='NetBook.asp?&page="+cstr(1)+"'><font color='#000000'>首页</font></a><font color='#ffffff'> </font></strong>"
Response.write "<strong><a href='NetBook.asp?page="+Cstr(currentpage-1)+"'><font color='#000000'>上一页</font></a><font color='#ffffff'> </font></strong>"
Else
Response.write "<strong><font color='#000000'>上一页 </font></strong>"
End if
If currentpage < Rs.PageCount Then
Response.write "<strong><a href='NetBook.asp?page="+Cstr(currentPage+1)+"'><font color='#000000'>下一页</font></a><font color='#ffffff'> </font>"
Response.write "<a href='NetBook.asp?page="+Cstr(Rs.PageCount)+"'><font color='#000000'>尾页</font></a></strong>&nbsp;&nbsp;"
Else
Response.write ""
Response.write "<strong><font color='#000000'>下一页</font></strong>&nbsp;&nbsp;"
End if
%>                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="1" colspan="2" bgcolor="#999999"></td>
                                  </tr>
                                </table>
                              <%
If rs.eof and rs.bof then
  response.write ""
  response.end
End if
%>
                                <br>
                                <table width="89%" height="18" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#00CC00" style="font-size:12px">
                                  <tr bgcolor="#99CCFF" class="top_m_txt01">
                                    <td width="56%" height="25" align="center" bgcolor="#CCCCCC"><p align="center"><font color="#000000"><b>留言主题</b></font></p></td>
                                    <td width="22%" height="21" align="center" bgcolor="#CCCCCC"><font color="#000000"><b>时间</b></font></td>
                                    <td width="22%" height="21" align="center" bgcolor="#CCCCCC"><font color="#000000"><b>回复</b></font></td>
                                  </tr>
                                  <%
if not rs.eof then
i=0
do while not rs.eof
%>
                                  <tr bgcolor="#99CCFF" class="top_m_txt01">
                                    <td height="22" bgcolor="#FFFFFF"><%if rs("name")="管理员"then%>
                                      『管理员公告』
                                      <%end if%>
                  <a href="javascript:winopen('NetBookRe.asp?id=<%=rs("id")%>&amp;name=<%=rs("name")%>')"> <%=rs("title")%></a></td>
                                    <td height="1" bgcolor="#FFFFFF" align="center">&nbsp; <%=rs("time")%></td>
                                    <td height="1" bgcolor="#FFFFFF" align="center">&nbsp;
                                        <%If rs("rebook")<>"" Then%>
                                        <a href="javascript:winopen('NetBookRe.asp?id=<%=rs("id")%>&amp;name=<%=rs("name")%>')">回复</a>
                                        <%else%>
                                      无
                                      <%End If%>
                                    &nbsp;</td>
                                  </tr>
                                  <%
i=i+1
if i >= MaxPerpage then exit do
rs.movenext
loop
end if
%>
                                  <%end sub%>
                                </table>
                              <br>

修改后:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Inc/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" />
<script language="javascript">
<!--
function winopen(url)
{
window.open(url,"search","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width=640,height=450,top=200,left=100");
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<title>留言本</title>
<style type="text/css">
<!--
body,td,th {
 font-size: 12px;
}
-->
</style></head>
<body>
<table width="648">
  <tr style="line-height:20px; border:#993300">
    <td width="218" style="border:1px solid #009900"><strong>留言主题</strong></td>
    <td width="98" style="border:1px solid #009900"><strong>留言日期</strong></td>
    <td width="316" style="border:1px solid #009900"><strong>状态</strong></td>
  </tr>
<%
   const MaxPerPage=16   '单独页最大记录数 const 用来申明常量
   dim sql
   dim rs
   dim totalPut   '总记录
   dim CurrentPage  '当前页次
   dim TotalPages   '总页数
   dim i
   sname=Session("UserName")
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT * FROM book WHERE name='"&sname&"' order by id desc"
rs.open sql,conn,1,1
if not rs.eof then
  '分页功能代码块,可独立使用
  rs.MoveFirst  '注意放到前面来,否则到任何页总是在第一个记录上
  rs.pagesize=MaxPerPage  '设置每页最多显示多少条记录
  If trim(Request("Page"))<>"" then  '如果请求的页次不为空
 CurrentPage= CLng(request("Page"))   'clng是转换成长整型数据类型,并赋值到当前页次上
 If CurrentPage> rs.PageCount then  '如果当前页次大于总页数,则将最大页次赋值到当前页次上
  CurrentPage = rs.PageCount
 End If
Else
 CurrentPage= 1 '一切条件不成立,将当前页设为第一页
End If
 totalPut=rs.recordcount '将总记录赋值于TOTALPUT
 if CurrentPage<>1 then '如果当前页数不等于第一页
  if (currentPage-1)*MaxPerPage<totalPut then  '如果当前页减一乘以每页最大的记录数小于总记录的话
   rs.move(currentPage-1)*MaxPerPage  '相对当前记录数向后移动
   dim bookmark  '定义书签变量
   bookmark=rs.bookmark '将当前记录的标签赋于变量BOOKMARK上
  end if
 end if

 dim n,k
 if (totalPut mod MaxPerPage)=0 then  '总记录数与每页最大记录数求余的结果为零时,则N返回整数页次,否则再加一.
  n= totalPut \ MaxPerPage
 else 
  n= totalPut \ MaxPerPage + 1 
 end if

i=0
Do While Not rs.EOF and i<maxperpage
%>

 

    <tr style="line-height:25px;">
    <td width="218" style="border:1px solid #009900"><%=rs("title")%></td>
    <td width="98" style="border:1px solid #009900"><%=rs("Time")%></td>
    <td width="316" style="border:1px solid #009900">
                                        <%If rs("rebook")<>"" Then%>
                                        <a href="javascript:winopen('NetBookRe.asp?id=<%=rs("id")%>&amp;name=<%=rs("name")%>')">已回复</a>
                                        <%else%>
                                      尚未回复-您可以致电管理员
                                      <%End If%>
      </td>
  </tr>
   <%
i=i+1
rs.movenext
loop
%>
</table>

 

 

          
            <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#f1f1f1" class="tbline">
              <tr>
                <td width="55%" height="25" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="5">
                    <tr>
                      <td align="center">页次:<strong><font color="#CC0033"><%=currentpage%></font>/<%=n%></strong> <strong><%=MaxPerPage%></strong>条/页 共<strong><%=rs.recordcount%></strong>条
                        <%
    '分页显示代码块 可独立使用,注意和上面分页功能代码配使用
    k=currentPage
  if k<>1 then
   response.write "【"+"<a href='index.asp?keyword="&keyword&"&page=1&lei="&lei&"'>首页</a>】"
   response.write "【"+"<a href='index.asp?keyword="&keyword&"&page="&cstr(k-1)&"&lei="&lei&"'>上一页</a>】"
  else
   Response.Write "【首页】【上一页】"
  end if
  if k<>n then
   response.write "【"+"<a href='index.asp?keyword="&keyword&"&page="&cstr(k+1)&"&lei="&lei&"'>下一页</a>】"
   response.write "【"+"<a href='index.asp?keyword="&keyword&"&page="&cstr(n)&"&lei="&lei&"'>尾页</a>】"
  else
   Response.Write "【下一页】【尾页】"
  end if
         
 %>
                        转到
                        <select name="select" onChange="if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}">
                          <%for a=1 to n %>
                          <option value="index.asp?keyword=<%=keyword%>&page=<%=a%>&lei=<%=lei%>">第<%=a%>页</option>
                          <%next%>
                        </select>
                      </td>
                    </tr>
                  </table></td>
              </tr>
              <tr>
                <td height="1" align="center" bgcolor="#CCCCCC"><img src="image/w" width="1" height="1"></td>
              </tr>
            </table>
            <%else response.Write "暂无日志"
end if%> </td>
        </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
  <% rs.close
set rs=nothing
conn.close
set conn=nothing %>

</body>
</html>
 

可以正常显示了。ok

标签:宏道企业管理系统的留言板回复的修改
分类:ASP| 发布:yingzi| 查看: | 发表时间:2009-4-27
原创文章如转载,请注明:转载自影子的网站 http://www.yingzi001.cn/
本文链接:http://www.yingzi001.cn/go/宏道企业管理系统的留言板回复的修改.html

相关文章

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

1 #KINHOI
KINHOI HI.方便加下你的QQ吗?
影子 于 2009-8-25 8:00:31 回复
给我留言即可,我会给你回复
http://WWW.JONY.COM.CN 2009-8-23 20:26:50 【REPLY】
Power By 影子