java script code email vilidation

HERE IS THE CODE

<html>
<head>
<script lang=javascript>
isEmail1    = /^\w+([\.\-]\w+)*\@\w+([\.\-]\w+)*\.\w+$/;
isEmail2    = /^.*@[^_]*$/;

function isEmail(s) 
{
  return (isEmail1.test(s) && isEmail2.test(s));
}


function validate(what) {


 if (!isEmail(what.txtemail.value))
 {
    alert('Invalid email id');
    return false;
 }
 else
 {
	  alert('WELCOME ID IS VALID');
}
//return true;
}

</script>
</head>
<body>
<form name=frm id=frm onsubmit='return validate(this);'>
<input type=text name=txtemail id=txtemail >
<input type=submit name=btnsub id=btnsub >
</form>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.