1、邮箱输入的地方   

  <label> 电子邮箱:</label>  

  <input />  

  <span ></span>

 

2、js中做验证

$("#email").bind('blur',function()

{  

var userMail=$("#email").val();  

if(userMail!="")

{   

if(!checkEmail(userMail))

{    

emailflag=false;       

$("#emailspan").css("color","#ff0000");       

$("#emailspan").html("邮箱格式不正确");   

}

else

{    

emailflag=true;    

$("#emailspan").css("color","#43860c");    

$("#emailspan").html("正确");   

}  

}

 });

3、checkEmail ()

function checkEmail(email)

{

var pattern =/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;

return pattern.test(email);

}

相关文章:

  • 2022-01-27
  • 2022-01-12
  • 2022-01-15
  • 2022-12-23
  • 2021-06-17
  • 2022-02-15
  • 2021-11-17
猜你喜欢
  • 2021-07-22
  • 2022-01-31
  • 2021-11-26
  • 2021-10-15
  • 2021-05-24
  • 2022-12-23
相关资源
相似解决方案