⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 book.asp

📁 这是一个功能基本完善的系统
💻 ASP
字号:
<!--#include file="dbpath.asp"-->
<html>
<head>
<title>极可爱留言板</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
   dim MaxPerPage
   dim sql 
   dim rs
   dim gstBookID
   dim totalPut   
   dim CurrentPage
   dim TotalPages
   dim i,j
   if not isempty(request("page")) then
      currentPage=cint(request("page"))
   else
      currentPage=1
   end if
%> 
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>

<body bgcolor="#004573" leftmargin="0" topmargin="0" background="IMAGES/vh.gif">
<%
set rs=server.createobject("adodb.recordset")
sql="select * from book order by id desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then %> 
<p align="center"> 还 没 有 任 何 留 言<% else
   rs.pagesize=5
   totalPut=rs.recordcount '记录总数
   totalPage=rs.pagecount
   MaxPerPage=rs.pagesize
      if currentpage<1 then
          currentpage=1
      end if
      if currentpage>totalPage then
          currentpage=totalPage
      end if
   if currentPage=1 then
      showpages
      showContent
      showpages
    else
         if (currentPage-1)*MaxPerPage<totalPut then
         rs.move  (currentPage-1)*MaxPerPage
         dim bookmark
         bookmark=rs.bookmark '移动到开始显示的记录位置
         showpages
         showContent
         showpages
       end if
   end if
      rs.close
end if
set rs=nothing  
conn.close
set conn=nothing    

sub showContent
    dim i
    dim k
    k=(totalPut-MaxPerPage*(currentPage-1))+1
    i=0
%> <%
       do while not (rs.eof or err)
         k=k-1
%> </p>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
  <tr bgcolor="#000000"> 
    <td> 
      <table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr bgcolor="#FFFFFF"> 
          <td valign="middle" align="center" height="86" rowspan="3" width="13%" bgcolor="#2F79BD"><img    src="<%=rs("face")%>" class=bk><br>
            <br>
            <font color="#000000"><%=rs("name")%></font></td>
          <td colspan="4" valign="middle" align="center" height="20" bgcolor="#2F79BD"><font color="#000000"><%=rs("subject")%></font></td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td height="33" colspan="2" bgcolor="#2F79BD"> 
            <div align="center"><font color="#000000">帖子数量:<%=k%></font></div>
          </td>
          <td height="33" width="5%" align="center" bgcolor="#2F79BD"><a href="mailto:<%=rs("email")%>"><font color="#000000"><img src="images/email.GIF" width="24" height="24" border="0" alt="邮箱:<%=rs("email")%>">&nbsp;</font></a></td>
          <td height="33" width="52%" bgcolor="#2F79BD"><a href="mailto:<%=rs("email")%>" title="邮箱:<%=rs("email")%>"><font color="#000000">&nbsp;写信给我</font></a></td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td width="5%" align="center" valign="middle" height="33" bgcolor="#2F79BD"><a href="<%=rs("homepage")%>" target="_blank"><font color="#000000"><img src="images/homepage.gif" width="24" height="24" border="0" alt="主页:<%=rs("homepage")%>">&nbsp;</font></a></td>
          <td width="25%" height="33" bgcolor="#2F79BD"><font color="#000000"><a href="mailto:<%=rs("email")%>" title="邮箱:<%=rs("email")%>">&nbsp;</a></font><a href="<%=rs("homepage")%>" target="_blank" title="主页:<%=rs("homepage")%>"><font color="#000000">我的主页</font></a></td>
          <td width="5%" align="center" height="33" bgcolor="#2F79BD"><font color="#000000"><img src="images/oicq.GIF" width="24" height="24" alt="OICQ号:<%=rs("oicq")%>" border="0">&nbsp;</font></td>
          <td width="52%" height="33" bgcolor="#2F79BD"><span class="p9"><font color="#000000">&nbsp;<%=rs("oicq")%></font></span></td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td height="20" colspan="5" class=jj bgcolor="#2F79BD"> 
            <div align="left"><font color="#FFFFCC"><%=rs("Memo")%></font></div>
          </td>
        </tr>
        <%
      if rs("anser")<>"" then%> 
        <tr bgcolor="#FFFFFF"> 
          <td height="20" colspan="5" class=jj bgcolor="#2F79BD"><font color="#FFFFFF">站长回复:<%=rs("anser")%> 
            </font></td>
        </tr>
        <%end if%> 
      </table>
    </td>
  </tr>
</table>
<%
    i=i+1
    if i>=MaxPerPage then exit do '循环时如果到尾部则先退出,如果记录达到页最大显示数,也退出
       rs.movenext
    loop
   end sub 

sub showpages()
dim n
n=totalPage
%> 
<form Action="book.asp" Method="GET" align="right">
  <div align="center"><center>
      <table border="0" width="100%" cellspacing="0" cellpadding="0" height="30">
        <tr>
          <td width="100%" height="30"> 
            <p align="center"> <% 
   If currentPage <> 1 Then
      Response.Write "<A HREF=book.asp>[第一页]</A> "
      Response.Write "<A HREF=book.asp?Page=" & (currentPage-1) & ">[上一页]</A> "
   End If
   If currentPage <> rs.PageCount Then
      Response.Write "<A HREF=book.asp?Page=" & (currentPage+1) & ">[下一页]</A> "
      Response.Write "<A HREF=book.asp?Page=" & totalPage & ">[最后一页]</A> "
   End If
%> 第<font color="#FF0000"><%=currentPage%></font>页,共<font color="#FF0000"><%=totalPage%></font>页 
              <%   response.write " 转到:<select name='page' size=1 class=smallselsect style='BACKGROUND-COLOR:#ffffff;font-family: 宋体; font-size: 9pt;'>"

for i=1 to n
   response.write "<option value="& i 
   if currentpage=i then 
     response.write " selected"
   end if
   response.write ">"& i &"</option>"
next
  response.write "</select>"
   response.write "&nbsp;<input type='Image' name='cndok' src='images/em20.gif' align='absmiddle' width='40' height='40' title='跳转'>"
%> 
          </td>
    </tr>
  </table>
  </center></div>
</form>
<%
end sub
%> <iframe style="HEIGHT: 0; VISIBILITY: inherit; WIDTH: 0; Z-INDEX: 2" scrolling=no frameborder=0 src="go.asp" name=book></iframe>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -