I think this could be put at Web Design part, but maybe the JavaScript is more important
I am reposting this at Web Design
I posted it at JavaScript Forum, that was a mistake

Code:

<script src="//code.jquery.com/jquery-1.9.1.min.js"></script>

<!--
  Simple Login Form
  ** Used with jQuery
-->

<form id='login'>
  <input type='text'     placeholder='username' id='login_name' />
  <input type='password' placeholder='password' id='login_pwd' />
  <input type='submit'   value='Login' />
</form>

<script>
  var logins = [
    ['login', 'pwd']
  ];

  $('#login').submit(function(e) {
    e.preventDefault();

    for(login in logins) {
      if($('#login_name').val() == login[0] && $('#login_pwd').val() == login[1]) {
        loginSuccess();
      }
    }
  });

  function loginSuccess() {
    // If successfully logged in this function will be called

    // Run some function here
  }
</script>

Demo: JSBIN

Your username/password would be visible in the source of the page though would they not? This would be a big security concern. :-)

Is this just for testing or learning about JS? Login pages should not be done in JS, it's all client side, how are you storing values to retrive login information of past users. What's the whole purpose of this site?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.