Ok, I posted this before but to be honest I lost the thread, so I'm asking again.

I put in a very simple JavaScript password check into a page that I am doing. The problem, However is that you have to actually hit the submit button to get it run, if you just hit enter nothing happens. The client wants it to run when you hit enter not the button. I've tried looking for information on this problem but haven't found anything. I could use some advice on this.

Here is my code if this will help:

<html>
<head>
<title>Password Check</title>
<script language="JavaScript" type="text/javascript">
<!--

var bad_password = true

function check_password() {


var password_value = document.forms [0].user_password.value
if (password_value) {

bad_password = false


document.images ["checker"].src = password_value + ".gif"
}
}
function test_password () {


if (!bad_password) {


var password_value = document.forms[0].user_password.value
self.location = password_value + ".htm"
status = ""
}
}
function password_error() {


bad_password = true


document.images["checker"].src = "smartmed1.gif"

status = "Password rejected"
alert ("Sorry your password is incorrect")
status = ""
}
//-->
</script>
<style type="text/css">

body
{
background-color: #000000
}

</style>
</head>
<body>
<img src="teitablelogo.jpg"></img><br>
<div>
<font color="red">&nbsp;&nbsp;PASSWORD CHECK</font></div><br><br>
<form>
<input type="password" name="user_password">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="Enter your password" onClick="check_password()">

</form>
<img src="smartmed1.gif"
name="checker"
height="1"
width="1"
onLoad="test_password()"
onError="password_error()">
<div>
<font color="red">THIS PAGE IS SECURITY ENABLED.<br>
YOU ARE ATTEMPTING TO ACCESS THE PRIVATE PLAN ROOM FOR SMART MEDICAL TECHNOLOGY</font></div>
</body>
</html>

As you can tell it just uses a simple gif replacement check.

Thanks
Jodi