<html> <head> <title>Sample Code</title> <script type="text/javascript"> function CheckEmail(strEmail) { var objRegex = /(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/; //Check Here Email String var test=objRegex.test(strEmail); if(test=true) { alert("Your Given Email Id Is \""+strEmail+"\" Correct."); } else { alert("Your Given Email Id Is Not \""+strEmail+"\" Correct."); } } </script> </head> <body bgcolor=#00ff00 alink=blue vlink=blue> <FORM name="windowEvent"> Email : <input type="text" name="txtemail" /> <input type="button" value="Check Email" name="btnEmail" onClick="CheckEmail(txtemail.value)" /> </FORM> </body> </html>
|