自已asp写了一个邮件格式(Email格式)检验程序,不过这种方法显然不够科学,更好的方法是用正则表达式来写,而且能在客户端执行的程序最好放在客户端执行,也就是用vbs/js脚本来实现。不过功能倒是全写出来了,嘿,背课时闲着无聊,就当练习了。
<%
dim emails
emails=Trim(Request.Form("form_email"))
if emails<>"" then
names=split(emails,"@")
if UBound(names)<>1 then
response.Write("邮箱地址至少有一个@,并且不能有多个@符号"&"<br>")
response.end
end if
dots=split(names(1),".")
if ubound(dots)<1 then
response.write("邮箱地址至少有一个.符号")
response.end
end if
for each name in names
if len(name)=0 then
response.write("缺少邮箱名")
response.end
end if
next
for each name in dots
if len(name)=0 then
response.write("邮箱域名不完整,")
if dots(0)="" then
response.write("域名前缀不能为空")
else
response.Write("域名后缀不能为空")
end if
response.end
end if
next
response.write("邮箱格式正确")
else
response.Write("邮箱地址不能为空"&"<br>")
end if
%>
js写法看这里:http://web.exiang.org/blog/user1/3/900.html