日期:2014-05-16  浏览次数:20937 次

求表单所有项必填的javascript代码
我在网上找了一个ASP留言到邮箱的代码
http://demo.anhao5.com/csly/sent.asp 这个是那个地址
但是当表格里面没有填写内容的时候 也可以 提交

我就是想把里面加个代码 提示用户 次项必须填写 
麻烦帮个忙谢谢
下面是代码
<%response.charset="gb2312"%>
<HTML><title>安昊网络在线留言反馈!www.anhao5.com</title>
<BODY>
<form action="sent.asp?go=sent" method="post"> 
<table>
<tr><td>姓名:</td><td><input name="name" type="text" id="name" value="" maxlength="5"></td></tr>
<tr><td>邮箱:</td><td><input type="text" name="email" id="email"></td></tr>
<tr><td>电话:</td><td><input name="tel" type="text" id="tel" maxlength="15" ></td></tr>
<tr><td>Q&nbsp;&nbsp;Q:</td><td><input type="text" name="qq" id="qq" ></td></tr>
<tr><td>是否需要邮件回复</td>
  <td><p>
    <label>
      <input name="yjhf" type="radio" id="yjhf_0" value="需要">
      需要</label>
    <label>
      <input type="radio" name="yjhf" value="不需要" id="yjhf_1">
      不需要</label>
    <br>
  </p></td>
</tr>
<tr><td>反馈信息:</td><td width="650"><textarea name="content" rows="5" cols="50"></textarea></td>
</tr>
<tr><td colspan="2" align="center"><INPUT name="button" TYPE="submit" id="button" value="提交留言"></td></tr>
</table>
</form>
<%
If request("go")<>"sent" Then response.End 
dim CLStr,msg,mailserver,username,password,receive
CLStr=Chr(13) & Chr(10)
'请在此修改相关信息
 mailserver="smtp.163.com" '邮局服务器地址(smtp服务器地址)
 username="anhao56@163.com" 'smtp服务器验证登陆名(用来做为代发邮件的地址)
 password="密码" 'smtp服务器验证密码 (信箱密码)
 receive="87450265@qq.com" '接受反馈信息的email地址(用来接收邮件的信箱)
'修改结束
Set msg = Server.CreateObject("JMail.Message")
msg.Charset = "gb2312"
msg.logging = true '启用邮件日志
msg.silent=True'屏蔽例外错误,返回False或True
'msg.ContentType = "text/html"'邮件的格式为HTML格式
msg.Priority = 1 '邮件等级,1为加急,3为普通,5为低级
msg.MailServerUserName = username
msg.MailServerPassword = password 
msg.From = username 
msg.FromName = username
msg.AddRecipient (receive)
msg.Subject = "安昊网络最新反馈信息:"&Request.Form("subject")

msg.HTMLBody = "安昊科技网站在线反馈信息"&CLStr&CLStr
msg.HTMLBody = msg.HTMLBody&"<br>对方姓名:"&Request.Form("name")&CLStr
msg.HTMLBody = msg.HTMLBody&"<br>对方邮箱:"&Request.Form("email")&CLStr
msg.HTMLBody = msg.HTMLBody&"<br>对方电话:"&Request.Form("tel")&CLStr
msg.HTMLBody = msg.HTMLBody&"<br>对方QQ号:"&Request.Form("qq")&CLStr
msg.HTMLBody = msg.HTMLBody&"<br>是否回复:"&Request.Form("yjhf")&CLStr
msg.HTMLBody = msg.HTMLBody&"<br>留言内容:<br>"
msg.HTMLBody = msg.HTMLBody&"<div style='font:9pt;background-color:#eeeeee'>"&Request.Form("c