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

📄 banjiluntan.asp

📁 本文件为利用ASP开发的管理信息系统项目,文件名为校友录,按照说明"校友录系统_数据表创建方法"来进行数据表的创建.
💻 ASP
字号:
<%@ Language=VBScript %>
<%if not session("user_session_id")=Session.SessionID then%>
<SCRIPT LANGUAGE=javascript>
 parent.window.location.href="default.asp"
</SCRIPT>
<%end if%>
<html>
<head>
<title>校友录-班级留言板</title>
<LINK href="inc/css.css" type=text/css rel=stylesheet>
<style TYPE="text/css"> 
<!-- 
 .popcomments 
{ 
position : absolute; width:130;
visibility : hidden; 
border: 1 solid #000001
} 
.in 
{
BORDER-RIGHT: rgb(127,127,127) 1px solid;
BORDER-TOP: rgb(127,127,127) 1px solid;
 FONT-SIZE: 9pt; 
 BORDER-LEFT: rgb(127,127,127) 1px solid; 
 BORDER-BOTTOM: rgb(127,127,127) 1px solid;
 BACKGROUND-COLOR: #ffffff
}
//--> 
</STYLE>
  <script language="javascript">
function stringTrim() {
	var strTemp = this;
	var spaceChar  = " ";
	while (strTemp.charAt(0) == spaceChar) {strTemp = strTemp.substr(1)};
	while (strTemp.charAt(strTemp.length-1) == spaceChar) {strTemp = strTemp.substr(0,strTemp.length-1)};
	return strTemp.toString();
}

String.prototype.trim = stringTrim;
function goto2(){
var s2=document.form2.content.value.trim()
 if (s2==""){
  window.alert ("请留言!\n谢谢!") 
  document.form2.content.select()
  return false;
 }
 if(s2.length>400){
 window.alert("留言内容不能超过400字!\n当前有"+s2.length+"个");
 window.document.form2.content.select()
 return false;
 }
document.form2.submit();

}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body  leftMargin=0 topMargin=0 text="#000000" onkeydown="if(event.keyCode==13 && event.ctrlKey) if (goto2()){window.document.form2.submit();}">
<div align=center></div>
<table cellspacing=0 cellpadding=0 width=720 border=0>
  <tbody> 
   <!--#include file="inc/top.asp"-->
  </tbody> 
</table>
<table width=750 border=0 align="center" cellpadding=0 cellspacing=0>
<tbody> 
<tr> 
<td height=518> 
 <table cellspacing=0 cellpadding=0 width=728 border=0>
   <tbody> 
   <tr>          
      <td valign=top width=488 align="right"><br>
        <table cellspacing=0 cellpadding=0 width=401 border=0>
      <tbody> </tbody> 
    </table>
       <%
       function sort(data)
           sort=Replace(data,"'","''")
       end function
            
        Dim action,p
       action=Request("action")
     IF action="tijiao" Then
            Dim content
            if sname="" Then sname="unkonwn"
             content=Trim(Request.Form ("content"))
   		  content=Replace(content,"<","&lt;")
   		  content=Replace(content,">","&gt;")
            content=Sort(Replace(content,VBCrlf,"<br>"))
            session("cn").execute ("insert into forum(studentid,content,pubtime,towho) values('"&sname&"','"&content&"','"&now()&"','everyone')")
            session("cn").execute ("update ec set forumtimes=forumtimes+1 where studentid='"&sname&"'")
   		 Response.Redirect("banjiluntan.asp")
   		 Response.End()
    End IF
       Dim sql,rst
       sql="select ec.studentid,ec.sname,ec.pic,forum.content,forum.pubtime from ec,forum "&_
" where forum.towho='everyone' and ec.studentid=forum.studentid order by pubtime desc"
       Set rst=Server.CreateObject ("ADODB.Recordset")
       rst.open sql,session("cn"),1
       const pagesize=4
       rst.PageSize=pagesize
       topage=rst.PageCount 
      IF rst.eof Then 
         Response.Write "当前无留言……"
      Else
           
      curpage=Request.QueryString("curpage")
      if curpage="" Then curpage=1
      curpage=cint(curpage)
       p=(curpage-1)\10+1
       if Request.QueryString ("p")<>"" Then
          p=cint(Request.QueryString ("p"))
          curpage=(cint(Request.QueryString ("p"))-1)*10+1
       end if
      rst.AbsolutePage=curpage     
      Dim xx
      if topage mod 10=0 then
            xx=(topage\10)
      else
            xx=(topage\10)+1
      end if
       %>
    <table border="0" cellspacing="1" width="100%">
      <tr> 
        <td align="right"> 共有留言<font color=red><b><%=rst.RecordCount%></b></font>条 
          共<font color=red><b><%=topage%></b></font>
          页 当前第<font color=red><b><%=curpage%></b></font>页 
          每页显示<font color=red><b><%=pagesize%></b></font>条 <br>
          <%showtitle%>
          <% For i=1 to rst.PageSize
                if rst.EOF then exit for
         %>
          <table width=471 border=1 cellpadding=0  cellspacing=0 bordercolor="#ABA7E4">
            <tr> 
              <td width="88">留言人:</td>
              <td width="75"><b><%=rst(1)%></b></td>
              <td width="94"></td>
              <td width="211" align="center"></td>
            </tr>
            <tr height="34"> 
              <td  width="88">头&nbsp;像:</td>
              <td  width="75"><img src=img/<%=rst(2)%>.bmp border="0"> </td>
              <td width="94">留言时间:</td>
              <td width="211"><%=rst(4)%></td>
            </tr>
            <tr height="34"> 
              <td colspan="8"><%=rst(3)%> </td>
            </tr>
          </table>
        <table width="400" border="0" cellspacing="0" cellpadding="0" height="13">
          <tr> 
            <td height="13"></td>
          </tr>
        </table>
        <%
        rst.MoveNext 
       Next
        %>
        <%showtitle%>
        <%End IF%>
                
        <br>
       </td>
    </tr>
    <tr>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请留言:</td>
      </tr>
    </table>
    <form method="POST" action="banjiluntan.asp?action=tijiao" name="form2" 
    onSubmit="return goto2();">
      <input type=hidden name=sname value=<%=sname%>>
      <p> 
        <textarea rows="8" name="content" cols="65" class=in></textarea>
        <br>
        注意:<font color=red>留言字数不要超过400</font></p>
      <p>&nbsp;&nbsp;&nbsp;&nbsp; 
        <input type="button" value="提交" name="B1" onclick="javascript:goto2()" class=in>
        &nbsp;&nbsp; 
        <input type="reset" value="重写" name="B2" class=in>
      </p>
    </form>
    <p>&nbsp;</p>
  </td>
  <td width=14>&nbsp;</td>
</tr>
 </tbody> 
    </table>
  </td>
</tr>

  </tbody> 
</table>
 <% sub  showtitle()%>
<div align=right> 
  <%if curpage<>1 then%>
  <A title=首页 href="banjiluntan.asp?curpage=1">
  <font face="webdings" color="#0033FF">9</font></A> 
  <%else%>
  <font face="webdings" color="#0033FF" title="首页" class=good>9</font> 
  <%end if%>
  <%if p=1 Then%>
  <font face=webdings title="已经是最前面了" class=good>7</font>
  <%else%>
  <a href="?p=<%=p-1%>"><font face=webdings title="前10页" class=good>7</font></a>
  <%end if%>
  <%for i=(p-1)*10+1 to (p-1)*10+10
  if i>topage then exit for
  if curpage=i then 
  Response.Write "<font color='ff0000'>"&i&"</font>"
  else%>
  <a title="第<%=i%>页" href="banjiluntan.asp?curpage=<%=i%>"><%=i%></a> 
  <%End IF
  Next%>
  <%if p>=xx Then%>
  <font face=webdings class=good title="已经是最后面了">8</font>
  <%else%>
  <a href="?p=<%=p+1%>"><font face=webdings title="后10页" class=good>8</font></a>
  <%end if%>
  <%if curpage<>topage then%>
  <A title=尾页 href="banjiluntan.asp?curpage=<%=topage%>"><FONT face=webdings>:</FONT></A> 
  <%else%>
  <A title=尾页 href="#"><FONT face=webdings>:</FONT></A> 
  <%end if%>
</div>
<%end sub%>
<%
rst.Close 

set rst=nothing
%>

⌨️ 快捷键说明

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