📄 add.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="ubbcode.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select * from guestbook order by id desc"
rs.open sql,dbconn,3,2
set rs1=server.createobject("adodb.recordset")
sql1="select class_name from class "
rs1.open sql1,dbconn,3,2
dim pagenum
dim e_page
e_page=3 '每页显示留言数
rs.pagesize=e_page
if request.querystring("pagenum")="" or request.querystring("pagenum")=0 then
pagenum=1
else
pagenum=request.querystring("pagenum")
rs.absolutepage=trim(request.querystring("pagenum"))
end if
%>
<SCRIPT language=JavaScript>
function is_number(str)
{
exp=/[^0-9()-]/g;
if(str.search(exp) != -1)
{
return false;
}
return true;
}
function is_email(str)
{ if((str.indexOf("@")==-1)||(str.indexOf(".")==-1))
{
return false;
}
return true;
}
function CheckInput(){
if(form.name.value==''){
alert("请填写您的留言昵称!");
form.name.focus();
return false;
}
if(form.name.value.length>20){
alert("昵称不能超过20个字符!");
form.name.focus();
return false;
}
if(!is_number(document.form.qq.value)){
alert("QQ号只能是数字哦!");
form.qq.focus();
return false;
}
if( form.email.value =="") {
alert("请输入您的E-mail !")
form.email.focus();
return false;
}
if(!is_email(form.email.value))
{ alert("您的EMail地址是错误的!");
form.email.focus();
return false;
}
if(form.title.value==''){
alert("请您填写留言标题!");
form.title.focus();
return false;
}
if(form.title.value.length>30){
alert("留言标题不能超过30个字符!");
form.title.focus();
return false;
}
if(form.content.value==''){
alert("您没有填写留言内容!");
form.content.focus();
return false;
}
if(form.content.value.length>300){
alert("留言内容超过300个字符!");
form.content.focus();
return false;
}
return true;
}
</SCRIPT>
<html>
<link href="style.css" rel="stylesheet" type="text/css">
<title>在线留言</title><BODY>
<CENTER><FORM action="save.asp" method=post name=form onsubmit=return(CheckInput())>
<table width="530" border="0" align="center" cellpadding="0" cellspacing="0" class="atable1">
<tr>
<td width="530" align="center" valign="top">
<TABLE cellSpacing=4 cellPadding=0
width="530" border=0>
<TR>
<TD align="center">
<table width="100%" border="0" align="center" bgcolor="#e6e6ff" class=log_titlewidth="450" >
<tr>
<td colspan="3"><table width="100%" border="0" class=log_titlewidth="100%">
<tr>
<td width="58%" align="right"><strong>发 表 留 言</strong></td>
<td align="right"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="5" colspan="3"><%
Randomize '初始代随机数种子
num1=rnd() '产生随机数num1
num1=int(26*num1)+65 '修改num1的范围以使其是A-Z范围的Ascii码,以防表单名出错
session("antry")="test"&chr(num1) '产生随机字符串
%>
<input name="temp" type="hidden" id="temp3" value="<%=session("antry")%>"></td>
</tr>
<tr>
<td width="129" height="23" align="right">留言昵称:</td>
<td colspan="2" align="left"><input name="name" type="text" size="20" class="input">
<font color="#FF0000">*</font> </td>
</tr>
<tr>
<td height="22" align="right"><p>电子邮箱:</p></td>
<td colspan="2" align="left"><input name="email" type="text" class="input" size="20">
<font color="#FF0000">*</font> </td>
</tr>
<tr>
<td height="23" align="right">留言QQ:</td>
<td colspan="2" align="left"><font color="#FF0000">
<input name="qq" type="text" size="20" class="input">
</font></td>
</tr>
<tr>
<td height="26" align="right">来自哪班:</td>
<td width="164" align="left"><select name="where" id="select2" onChange="backwav.src='facechange.wav';" size="1" style="border: 1px solid #E6E6E6">
<option value="保密">选择所在班级</option>
<% do while not rs1.eof %>
<option value="<%=rs1(0)%>"><%=rs1(0)%></option>
<%rs1.movenext
loop
%>
</select> </td>
<td width="182" rowspan="2" align="left"><img src="face/1.gif" id="iface" width="32" height="32"></td>
</tr>
<tr>
<td height="26" align="right">选择头像:</td>
<td align="left"><select name="select" onChange="document.images['iface'].src=options[selectedIndex].value;backwav.src='facechange.wav';" size="1" style="border: 1px solid #E6E6E6">
<option value="face/1.gif" selected>NO.01</option>
<option value="face/2.gif">NO.02</option>
<option value="face/3.gif">NO.03</option>
<option value="face/4.gif">NO.04</option>
<option value="face/5.gif">NO.05</option>
<option value="face/6.gif">NO.06</option>
<option value="face/7.gif">NO.07</option>
<option value="face/8.gif">NO.08</option>
<option value="face/9.gif">NO.09</option>
<option value="face/10.gif">NO.10</option>
<option value="face/11.gif">NO.11</option>
<option value="face/12.gif">NO.12</option>
<option value="face/13.gif">NO.13</option>
<option value="face/14.gif">NO.14</option>
<option value="face/15.gif">NO.15</option>
<option value="face/16.gif">NO.16</option>
<option value="face/17.gif">NO.17</option>
<option value="face/18.gif">NO.18</option>
<option value="face/19.gif">NO.19</option>
<option value="face/20.gif">NO.20</option>
<option value="face/21.gif">NO.21</option>
<option value="face/22.gif">NO.22</option>
<option value="face/23.gif">NO.23</option>
<option value="face/24.gif">NO.24</option>
<option value="face/25.gif">NO.25</option>
<option value="face/26.gif">NO.26</option>
<option value="face/27.gif">NO.27</option>
<option value="face/28.gif">NO.28</option>
<option value="face/29.gif">NO.29</option>
<option value="face/30.gif">NO.30</option>
</select>
[<a href="photo.asp" target="_blank">头像列表</a>]</td>
</tr>
<tr>
<td height="26" rowspan="3" align="right">留言表情:</td>
<td colspan="2" align="left"><input name="face" type="radio" value="1" checked>
<img src="icons/1.gif" width="20" height="20">
<input type="radio" name="face" value="2">
<img src="icons/2.gif" width="20" height="20">
<input type="radio" name="face" value="3">
<img src="icons/3.gif" width="20" height="20">
<input type="radio" name="face" value="4">
<img src="icons/4.gif" width="20" height="20">
<input type="radio" name="face" value="5">
<img src="icons/5.gif" width="20" height="20">
<input type="radio" name="face" value="6">
<img src="icons/6.gif" width="20" height="20"></td>
</tr>
<tr valign="middle">
<td colspan="2" align="left"><input type="radio" name="face" value="7">
<img src="ICONS/7.gif" width="20" height="20">
<input type="radio" name="face" value="8">
<img src="icons/8.gif" width="20" height="20">
<input type="radio" name="face" value="9">
<img src="icons/9.gif" width="20" height="20">
<input type="radio" name="face" value="10">
<img src="icons/10.gif" width="20" height="20">
<input type="radio" name="face" value="11">
<img src="icons/11.gif"width="20" height="20">
<input type="radio" name="face" value="12">
<img src="icons/12.gif" width="20" height="20"></td>
</tr>
<tr valign="middle">
<td colspan="2" align="left"><input type="radio" name="face" value="13">
<img src="icons/13.gif"width="20" height="20">
<input type="radio" name="face" value="14">
<img src="icons/14.gif"width="20" height="20">
<input type="radio" name="face" value="15">
<img src="icons/15.gif"width="20" height="20">
<input type="radio" name="face" value="16">
<img src="icons/16.gif"width="20" height="20">
<input type="radio" name="face" value="17">
<img src="icons/17.gif"width="20" height="20">
<input type="radio" name="face" value="18">
<img src="icons/18.gif"width="20" height="20"></td>
</tr>
<tr>
<td align="right">留言标题<font color="#000000">:</font></td>
<td colspan="2" align="left"><input name="title" type="text" size="30" class="input" >
<font color="#FF0000">* </font></td>
</tr>
<tr>
<td align="right" valign="middle"><font color="#000000">留言内容:<br>
<br>
</font> </td>
<td colspan="2" align="left"><p>
<textarea name="content" cols="40" rows="9" id="textarea3" class="textarea"></textarea>
</p></td>
</tr>
<tr>
<td colspan="3" valign="middle"><table width="100%" border="0">
<tr>
<td align="center"><br>
<input name="submit" type="submit" class=log id="submit3" value="发表留言">
<input name="show" type="hidden" value="1">
<input class=log type="reset" name="Submit2" value="清除留言"> </td>
</tr>
</table></td>
</tr>
</table>
</TD>
</TR> </TABLE></td>
</tr>
</table>
</form>
</CENTER>
</BODY>
</html>
<%rs.close
set rs=nothing
rs1.close
set rs1=nothing
%>
<%dbconn.close%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -