Posted By

krisdb on 03/09/07


Tagged

javascript


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Hirmine
vali29
appeltauer


valid email


 / Published in: JavaScript
 

  1. function validEmail(str,sErrMsg) {
  2. var filter = /^.+@.+\..{2,3}$/;
  3.  
  4. if (filter.test(str))
  5. return true;
  6. else {
  7. alert(sErrMsg);
  8. frm.focus();
  9. return false;
  10. }
  11. }
  12.  
  13. onSubmit="return validEmail(document.FORMNAME.email.value,'Please enter a valid email address');"

Report this snippet  

You need to login to post a comment.