title: Simple Javascript login form
body: <pre><code>&lt;form id="loginForm"&gt; 
      &lt;p id="usernameLabel"&gt;Username:&lt;/p&gt;
      &lt;input type="text" name="username" id="username" placeholder="username"/&gt;&lt;br&gt;
      &lt;p id="passwordLabel"&gt;Password: &lt;/p&gt;
      &lt;input type="password" name="password" id="password" placeholder="password"/&gt;&lt;br&gt;
      &lt;input id="loginButton" type="submit" value="Login!" onsubmit="validateForm()"&gt;
  &lt;/form&gt;
  &lt;p id="loginMessage"&gt;Please Login!&lt;/p&gt;
  
  &lt;script type="text/javascript"&gt;
      function validateForm() {
          var un = document.loginForm.username.value;
          var pw = document.loginForm.password.value;
          var username = "MitchWardle"; 
          var password = "123abc456";
          if ((un == username) &amp;&amp; (pw == password)) {
              window.location = "content.html";
              return false;
          }
          else {
              alert ("Login was unsuccessful, please check your username and password");
          }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>I have created a little login form on Javascript and I want it to navigate to Content.html when username and password are correct but when I click my Login button it just removes the text from the text box's, can anybody see whats wrong?</p>