教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp.net  >  正文 二款asp 邮箱地址验证代码

二款asp 邮箱地址验证代码

发布时间:2016-09-26   编辑:jiaochengji.com
教程集为您提供二款asp 邮箱地址验证代码等资源,欢迎您收藏本站,我们将为您提供最新的二款asp 邮箱地址验证代码资源

邮箱验证代码一
<html>
<head>
<title>example30</title>
<%
 function chkemail(email)       '定义过程
  chkemail=true        '初始化函数结果          
  names=split(email,"@")       'split函数是将字符串用指定的字符分割成多个子字符串,并将这些子字符串保存在一维数组中
  if ubound(names)<>1 then      'ubound函数返回数组的最大下标
   chkemail=false       '邮件格式错误,返回false
   exit function       '跳出过程
  end if
  for each name in names       'for each循环语句
   if len(name)<=0 then      'len函数获得字符串的长度
    chkemail=false      '邮件格式错误,返回false
    exit function      '跳出过程
   end if
  next
 end function                '结束过程的定义
%>
</head>
<body>
<form method="post" action="example30.asp" name = form1>
 <p align="center">请输入电子邮箱:<input type="text" name="email" size="20" value=<%=request.form("email")%>></p>
 <p align="center"><input type="submit" value="确定" name="submit"></p>
</form>
<%
 if request.form("submit")="确定" then      '单击【确定】按钮
  email=request.form("email")      '读取输入的字符串
  if chkemail(email) then       '调用chkemail过程
   response.write("<script>alert('邮件格式正确')</scirpt>") '返回true,则提示格式正确
  else         '返回false
   response.write("<script>alert('邮件格式错误')</script>") '提示格式错误
  end if
 end if
%>
</body>
</html>

邮箱验证代码二
<html>
<head>
<title>example31</title>
</head>
<body>
<form method="post" action="example31_index.asp" name = form1>
 <p align="center">请输入电子邮箱:<input type="text" name="email" size="20" value=<%=request.form("email")%>></p>
 <p align="center"><input type="submit" value="确定" name="submit"></p>
</form>
<%
 if request.form("submit")="确定" then      '单击【确定】按钮
  email=request.form("email")      '读取输入的字符串
  if chkemail(email) then       '调用chkemail过程
   response.write("<script>alert('邮件格式正确')</scirpt>") '返回true,则提示格式正确
  else         '返回false
   response.write("<script>alert('邮件格式错误')</script>") '提示格式错误
  end if
 end if
%>
</body>
</html>

您可能感兴趣的文章:
邮箱地址验证的方法(php、js)
php邮箱检测的正则表达式一例
js电子邮箱验证代码
PHP邮箱地址正确性验证示例
php邮箱验证的正则表达式代码
php正则验证邮箱的函数
二款asp 邮箱地址验证代码
jquery中邮箱地址 URL网站地址正则验证实例代码
jquery无刷新验证邮箱地址实现实例
jquery验证手机号码、邮箱格式是否正确示例代码

[关闭]
~ ~