网页留言栏的代码
发布网友
发布时间:2022-04-30 02:28
我来回答
共4个回答
热心网友
时间:2022-04-21 06:21
在<HEAD>里添加</script>
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) = "userinfo") Then
MM_editConnection = MM_conn_STRING
MM_editTable = "user"
MM_editRedirectUrl = "index005.asp"
MM_fieldsStr = "username|value|Usermail|value|Userqq|value|Address|value|Postcode|value|Usertel|value|url|value|zhuti|value|Communication|value"
MM_columnsStr = "Username|',none,''|Usermail|',none,''|Userqq|',none,''|Address|',none,''|Postcode|',none,''|Usertel|',none,''|url|',none,''|zhuti|',none,''|Communication|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
在<BODY>里添加
<table width="534" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="css1">
<tr>
<td><table width="96%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" height="152" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="13%" height="19" align="right" class="STYLE2">用户名:</td>
<td width="35%"><div align="left">
<label>
<input name="username" type="text" id="username" value="游客" size="25" />
</label>
</div></td>
<td width="15%" class="STYLE2">E-mail:</td>
<td width="37%"><input name="useremail" type="text" class="input0" id="useremail" size="25" /></td>
</tr>
<tr>
<td height="19"><div align="right" class="STYLE2">qq:</div></td>
<td><div align="left">
<label>
<input name="userqq" type="text" class="input0" id="userqq" size="25" />
</label>
</div></td>
<td><div class="STYLE2">个人主页:</div></td>
<td><input name="url" type="text" class="input0" id="url" value="http://" size="25" /></td>
</tr>
<tr>
<td height="19"><div align="right" class="STYLE2">主题:</div></td>
<td colspan="3"><div align="left">
<label>
<input name="zhuti" type="text" class="input0" id="zhuti" size="40" />
</label>
</div></td>
</tr>
<tr>
<td height="65" align="right"><span class="STYLE2">内容:</span></td>
<td colspan="3"><label> </label>
<div align="left">
<textarea name="Communication" cols="60" rows="4" class="input0" id="Communication"></textarea>
</div></td>
</tr>
<tr>
<td colspan="4" class="STYLE79"><table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><label> </label>
<div align="center">
<input name="regSubmit" type="submit" class="css2" id="regSubmit" onClick="return check();" value="留言" />
</div></td>
<td><label> </label>
<div align="center">
<input name="Submit5" type="reset" class="css2" id="Submit5" value="重置" />
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="userinfo" />
<script language="JavaScript" type="text/javascript">
function check()
{
// if(document.userinfo.username.value=="")
// { document.userinfo.username.focus();
// alert("用户名不能为空!");
// return false;
// }
// if(document.userinfo.username.value.length < 4)
// { document.userinfo.username.focus();
// alert("用户名的长度不小于4个字符!");
// return false;
// }
if(document.userinfo.useremail.value=="")
{ document.userinfo.useremail.focus();
alert("Email 不能为空!");
return false;
}
if(document.userinfo.useremail.value.charAt(0)=="."||
document.userinfo.useremail.value.charAt(0)=="@"||
document.userinfo.useremail.value.indexOf('@',0) == -1||
document.userinfo.useremail.value.indexOf('.',0) == -1||
document.userinfo.useremail.value.lastIndexOf("@")==document.userinfo.useremail.value.length-1 ||
document.userinfo.useremail.value.lastIndexOf(".")==document.userinfo.useremail.value.length-1)
{
alert("Email地址格式不正确!");
document.userinfo.useremail.focus();
return false;
}
if(document.userinfo.Address.value=="")
{ document.userinfo.Address.focus();
alert("地址不能为空!");
return false;
}
if(document.userinfo.Postcode.value=="")
{ document.userinfo.Postcode.focus();
alert("邮编请认真填写!");
return false;
}
if(document.userinfo.Communication.value=="")
{
document.userinfo.Communication.focus();
alert("您需要的项目内容不为空!");
return false;
}
return true
}
</script>
</td>
</tr>
</table>
<hr size="1" color="#101010" />
</td>
</tr>
</table>
热心网友
时间:2022-04-21 07:39
网站源码之家上有留言本的源文件模板,可下载!http://www.codejia.com/asp/如果你不懂程序语言的话,就不要弄了!去学一学吧,没有你想的那么难!
热心网友
时间:2022-04-21 09:13
比较简单,我可以帮你写个。写完了发你邮箱!
热心网友
时间:2022-04-21 11:05
这个一般都是用程序实现的,去下载个简单的ASP留言板挂上