Friday, April 9, 2010

Email Validation using Javascript

if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,5})+$/.test(affiliate.email.value))){
      alert("Please enter Valid Email Address");
      affiliate.email.focus();
      return false;
  }

in the above case 'affiliate' is the form name & 'email' is the textbox name to test.

No comments: