<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>表单验证</title> </head> <body> <input type="text" name="" placeholder="请输入..." id="ipt"> </body> <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> <script type="text/javascript"> $(function(){ $('#ipt').blur(function(){ if(this.value==''||this.value!==''&&!/.+@.+\.[a-zA-Z]{2,4}$/.test(this.value)){ alert("请输入正确的e-mail地址"); }else{ alert('输入正确'); } }) }); </script> </html>