title: Hitting Enter to Submit Password Form, Works if Incorrect, Fails if Correct
body: <p>This password form behaves as expected when the password is incorrect, but when the password is correct then hitting ENTER on the KEYBOARD doesn't submit the form.</p>
  
  <p>Here's the JavaScript:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function TheLogin() {
    var password = 'beyond';
    if (this.document.login.pass.value == password) {
      top.location.href = "streettherapy224984.html";
    } else {
      window.alert("INCORRECT PASSWORD. ACCESS DENIED.");
    }
  }
  
  function forceLower(strInput) {
    strInput.value = strInput.value.toLowerCase();
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form name="login" style="margin: 5px 0px 0px 0px;"&gt;
    &lt;input class="main" type="text" name="pass" size="64" onkeydown="if(event.keyCode==13) document.getElementById('codebtn').click()" style="width: 230px;" onkeyup="return forceLower(this);"&gt;&lt;br&gt;
    &lt;div id="spacer20"&gt;&lt;/div&gt;
    &lt;input class="main" type="button" id="codebtn" value="Submit" onclick="javascript:TheLogin(this.form)"&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I'm totally lost so any help figuring this out would be very much appreciated!</p>