<html>
     <head>
          <script>
                String.prototype.ValidateEmail = function (evt)
                {
                        var eVal = new RegExp("\\w+([-+.\’]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
                        var chkVal = eVal.exec(this);
                        if(chkVal != null)
                       {
                                alert('Id Correct');
                       }
                       else
                       {
                               alert('Check Your Id');
                       }
            </script>
        </head>
    <body>
         <input type="text" id="txtEmail" width="30px" onblur="this.value.ValidateEmail();" />
   </body>
</html>
ProgramDemo
 
No comments:
Post a Comment