title: Javascript e-mail validation of specific domains
body: <p>I can’t figure out what is missing so that when e-mail is valid it will skip the last invalid message and move to next item on form for validation:</p>
  
  <pre><code>enter code here 
      if (document.form1.email.value.length &gt; 0) {
  
      var tst = document.form1.email.value;
      var okd = ['bankofamerica.com','baml.com','magner.com','ml.com','ust.com','ustrust.com']
      for (var i = 0; i &lt; okd.length; i++) { okd[i] == okd[i].toLowerCase() }
  
      var emailRE = /^[a-zA-Z0-9._+-]+@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})$/
      var aLst = emailRE.exec(tst)
      if (!aLst) {
          alert(tst + ' is not a valid e-mail')
      } else {
          var sLst = aLst[1].toLowerCase()
          for (var i = 0; i &lt; okd.length; i++) {
              if (sLst == okd[i]) {
                  //    alert(aLst[1] + ' is allowed');--&gt;
  
             }
         }
  
              if (i == okd.length) alert(aLst[1] + ' is not allowed.  Please enter an email address with an authorized domain.')
  
              document.form1.email.select();
              return false;
  
  
      }   
  }
  </code></pre>