📄 add.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file=doc/config.asp-->
<!--#include file="conn.asp"-->
<%
if session("name")="" then
call Msgbox("请先登陆!","goUrl","login.asp")
response.End
end if
%>
<%
if request("submit")<>"" then
subject=trim(request.Form("subject"))
content=trim(request.Form("content"))
category=request.Form("category")
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from word",conn,1,3
rs.addnew
rs("name")=session("name")
rs("subject")=subject
rs("content")=content
rs("adddate")=now()
rs("category")=category
rs.update
rs.close
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>发表留言</title>
<style type="text/css">
<!--
.style1 {font-family: Tahoma}
.style2 {font-size: 12px}
.style3 {font-family: Tahoma; font-size: 12px; }
.style4 {font-size: 14px}
.style5 {font-family: Tahoma; font-size: 14px; }
-->
</style>
</head>
<link type="text/css" href="css.css" rel="stylesheet">
<body background="images/bottom-z.gif">
<table width="807" height="125" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td><!--#include file="head.asp"--></td>
</tr>
</table>
<table width="807" height="256" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#FFFFFF">
<tr>
<td width="143" height="256" valign="top"><!--#include file="left.asp"--></td>
<td width="664" valign="top">
<form name="form1" method="post" action="add.asp">
<table width="662" height="121" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="91" height="26"><span class="style5">用户名:</span></td>
<td width="571"><%=session("name")%> </td>
</tr>
<tr>
<td width="91" height="26"><span class="style5">留言类别:</span></td>
<td width="571">
<select name="category" size="1">
<%
rs.open "select * from category order by categoryid",conn,1,1
if rs.eof and rs.bof then
response.write "暂时没有分类!"
response.end
else
do while not rs.eof
%>
<option value=<%=rs("category")%>><%=rs("category")%> </option>
<%
rs.movenext
loop
rs.close
end if
%>
</select></td>
</tr>
<tr>
<td height="30"><span class="style5">主题:</span></td>
<td><input name="subject" type="text" id="subject" size="55"></td>
</tr>
<tr>
<td height="33"><span class="style5">留言内容</span>:</td>
<td><textarea name="content" cols="55" rows="11" id="content"></textarea></td>
</tr>
<tr>
<td height="32" align="right"> </td>
<td><input name="submit" type="submit" id="submit" value="发表留言" onClick="return aa(form1)"> <input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
<script language="javascript">
function aa(form1){
if (form1.subject.value=="")
{alert("主题不能为空!");form1.subject.focus();return false;}
if (form1.content.value=="")
{alert("留言内容不能为空!");form1.content.focus();return false;}
}
</script>
</form>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -