Mega Code Archive

 
Categories / JavaScript DHTML / Form Control
 

Validate email address

function isEMailAddr(elem) {     var str = elem.value;     var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;     if (!str.match(re)) {         alert("Verify the e-mail address format.");         setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);         return false;     } else {         return true;     } }