The below code is used to access a webpage I called myPage.html by entering a password of 1234. Once the password is entered the User either clicks the Login Button or presses the "Enter" key.
Clicking the login button works OK. My problem is that I have to press the Enter key twice for it to go to myPage.html
What do I need to change so I only have to press the Enter key once?
function TheLogin() {
var password = '1234';
if (this.document.login.pass.value == password) {
top.location.href="http://myPage.html";}
}
</script>
<p align="center">
<p align="center"><br>
<p align="center"><font size="5"><b><font color="#000000">Please enter the Password to Enter</font></b></font><br>
<p> </p>
<center>Enter your password:<br>
<form name="login" style="margin: 0px">
<INPUT TYPE="password" NAME="pass" size="17" onKeyDown="if(event.keyCode==13) event.keyCode=9;" style="width: 152px; margin: 5px;"><br>
<input type="button" value="Click to Login" style="width : 150px; margin: 3px" onClick="TheLogin(this.form)">
</form>
</center>