正则表达式验证邮箱
2013-04-23 17:59
274 查看
View Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>正则表达式验证邮箱</title> <script> window.onload=function() { var oTxt=document.getElementById('txt'); var oBtn=document.getElementById('btn'); oBtn.onclick=function() { var reg=/^\w+@[a-z0-9]+\.[a-z]+$/i; if(reg.test(oTxt.value)) { alert('对'); } else { alert('错'); } }; }; </script> </head> <body> <input type="txt" id="txt" /> <input type="button" value="验证" id="btn" /> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>正则表达式验证邮箱</title> <script> window.onload=function() { var oTxt=document.getElementById('txt'); var oBtn=document.getElementById('btn'); oBtn.onclick=function() { var reg=/^\w+@[a-z0-9]+\.[a-z]+$/i; if(reg.test(oTxt.value)) { alert('对'); } else { alert('错'); } }; }; </script> </head> <body> <input type="txt" id="txt" /> <input type="button" value="验证" id="btn" /> </body> </html>
相关文章推荐
- 正则表达式验证邮箱
- iOS - 正则表达式判断邮箱,身份证,手机,车牌号...验证是否正确
- python正则表达式——验证密码邮箱
- 正则表达式验证身份证格式,邮箱格式
- JS正则表达式验证手机号、电话和邮箱
- 使用js和正则表达式验证邮箱、手机号码、密码等
- (转) 正则表达式大全,手机、电话、邮箱、身份证(最严格的验证)、IP地址、网址、日期
- JS 正则表达式验证帐号/手机号/电话号/邮箱
- 验证邮箱和手机号码是否有效的正则表达式
- 比较正宗的验证邮箱的正则表达式js代码详解
- 邮箱及密码的正则表达式验证(C#)
- java正则表达式验证手机号码ip,邮箱
- PHP用正则表达式(re)验证邮箱
- iOS开发中邮箱,电话号码,身份证,密码,昵称正则表达式验证
- 正则表达式 验证邮箱地址(替换功能的练习)
- JS正则表达式验证账号、手机号、电话、邮箱、货币
- java正则表达式验证手机号码ip,邮箱
- 常用正则表达式大全,手机、电话、邮箱、身份证(最严格的验证)、IP地址、网址、日期等,一般前台js验证,来这里就够了...
- 邮箱、帐号、手机号和电话的javascript正则表达式验证方法
- js正则表达式验证邮箱