简单正则匹配QQ邮箱

简单正则匹配QQ邮箱

简单正则匹配QQ邮箱


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="../jquery-3.1.0.js" ></script>
<title></title>
<style type="text/css">
#txt{
border: 2px solid #90EE90;
font-size: 20px;
}
#txt2{
margin-top: 100px;
width: 200px;
height: 50px;
border: 2px solid blue;
text-align: center;
font-size: 25px;
}
#btn{
width: 200px;
height: 50px;
font-size: 40px;
font-weight: bold; background-image: linear-gradient(pink,lightblue,lightgreen); }
</style>
</head>
<body>
<textarea rows="5" cols="30" id="txt"></textarea><br>
<input type="button" name="btn" id="btn" value="验证" /><br>
<input type="text" name="" id="txt2" value="" />
</body>
</html>
<script type="text/javascript"> $(function(){ var txt =document.getElementById('txt');
var txt2 = document.querySelector('#txt2')
var btn =document.getElementById('btn'); btn.onclick = function(){ var reg1 = /^\w{5,}@[a-z0-9]{2,3}\.[a-z]+$|\,$/; if(reg1.test(txt.value))
{ txt2.value = '验证成功!'
var a1 = txt2.value
console.log(a1)
$('#txt2').css('color','blue')
}
else
{
txt2.value = '验证失败!'
$('#txt2').css('color','red') }
} }) </script>
上一篇:C# EasyUI树形结构权限管理模块


下一篇:RazorEngine在非MVC下的使用,以及使用自定义模板