title: Linking Page and client-side password HTML/JS
body: <p>As part as a HTML/JS learning exercise, I am trying to create a very simple user authentication user html forms. I know that it's better to send the input to a server-side PHP but I just want to create a form that :</p>
  
  <ol>
  <li>Creates a simple form</li>
  <li><p>Creates a submit button that reads a form element</p></li>
  <li><p>Use a javascript function to validate using an onclick (when submitted) attribute if that form item is the required password to access the next page.</p></li>
  </ol>
  
  <p>Here is my code so far:</p>
  
  <p>My HTML
          </p>
  
  <pre><code>        &lt;div id="login"&gt;
  
          &lt;fieldset&gt;
              &lt;legend&gt;Login&lt;/legend&gt;
              Password: &lt;input id ="pswd" type="password" name="psw" value=""&gt;
              &lt;br&gt;
              &lt;input type="submit" value ="Submit" onclick = "formValidate()"&gt;
          &lt;/fieldset&gt;
  
          &lt;/div&gt;
  
      &lt;/div&gt;
  </code></pre>
  
  <p>My JS</p>
  
  <pre><code>function formValidate(){
      var validated: false;
      if(document.getElementById("pswd").value == "a"){
          alert("Wow this worked");
          validated = true;
      }
      return validated;
  }
  </code></pre>
  
  <p>I just don't seem to have the proper knowledge on how to link html items  to JS functions and vice versa. When I check online it uses forms mainly to do PHP stuff. </p>
  
  <p>Furthermore, if someone can also put me on the right track as to where to look to then send my user to a new page if the password is correct. (In this case, a simple "a")</p>
  
  <p>Thanks,
  Alex</p>