title: Validating email and password using javascript
body: <p>I know its good to use serverside validation for security, except this is just to get my head around validation.</p>
  
  <p>My efforts so far have amounted to the following</p>
  
  <pre><code>function validateUser()
  {
      var x=document.forms["myForm"]["email"].value;
      var y=document.forms["myForm"]["password"].value;
      var atpos=x.indexOf("@");
      var dotpos=x.lastIndexOf(".");
      var uppercase = password.match(/[A-Z]/)
      var lowercase = password.match(/[a-z]/g)
      var number = password.match(/[0-9]/g)
      if (atpos&lt;1 || dotpos&lt;atpos+2 || dotpos+2&gt;=x.length)
      {
      alert("Not a valid e-mail address or password");
      return false;
      }else{ 
      alert("Valid Email Address and Password");
      return true;
  
      }
      }
  </code></pre>
  
  <p>Basically, I need an alert box to pop up when the password doesn't have at least 1 lowercase, uppercase and a number. So far my code is just throwing an error when the email is in the wrong format. What do I add to the if statement to check the password characters?</p>
  
  <p>Thanks in advance,</p>
  
  <p>James</p>