• Twitter
  • Facebook
  • Google+
  • Instagram
  • Youtube

Thursday, December 6, 2007

Use Regular Expression by JavaScript

Use Regular Expression by JavaScript
===============================

    1 function validateEmail()

    2     {

    3         // Value to Validate. Ex. Your EMail Address TextBox

    4         var EMailID = document.getElementById('txtEMail').value;

    5 

    6         // Here, we set the Expression to Validate the Value for EMail Address.

    7         var EMailValidate = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;

    8 

    9         // Test the Validator.

   10         if( EMailValidate.test(EMailID)) 

   11         {

   12             alert('Right Email Address.');

   13         }

   14         else

   15         {

   16             alert('Wrong Email Address.');

   17         }

   18     }    

0 comments:

Contact

Get in touch with me


Adress/Street

12 Street West Victoria 1234 Australia

Phone number

+(12) 3456 789

Website

www.johnsmith.com