I am trying to validate a form to ensure that the entered email address value is in the correct format. I have everything working except checking that it only contains one '@' symbol. This is my code so far
var x = document.forms["registration"]["email"].value;
var atpos = x.indexOf("@");
var dotpos = x.lastIndexOf(".");
if (atpos< 1 || dotpos<atpos+2 || dotpos+2>=x.length) {
    alert("Not a valid e-mail address");
    return false;
 
     
     
     
    