title: Want to validate email address in JavaScript but can't figure out how to include only one @ in the character string
body: <p>So far I have this:</p>
  
  <pre><code>function validateForm() {
  var str=document.forms["myForm"]["email"].value;
  var atpos=str.indexOf("@");
  var dotpos=str.lastIndexOf(".com");
     if (atpos&gt;0 || dotpos&lt;atpos+2 || dotpos+2&gt;=str.length) 
   {
     alert("Incorrect e-mail address");
     return false;
    }
  }
  </code></pre>
  
  <p>How can I include the '@' to be shown ONCE in the character string? (So an email can't be validated as @@).</p>
  
  <p>I also would appreciate it if it were anything but the regex method.</p>