1.

Solve : Heeelllp! Submit form by pressing enter??

Answer»

Hi there,

I'm hoping this is a pretty easy thing to do, and that it is me MISSING something. My password submit button on my html page will only work when the USER clicks on submit and does not work when the user just presses "Enter".

How can I change this so that the user can submit the password by pressing "Enter"?

Here is my code:

Code: [SELECT]
<script language="JAVASCRIPT">

function pasuser(form)
{
if (form.pass.value=="password")
{
location = "page2.html"
}
else {
alert("Invalid Password")
}
}

</script>


<form name="login">
<INPUT name="pass" type="password">
<input type="button" value="Login" onClick="pasuser(this.form) ">
<input type="Reset">
</form>


Change the input type of the login button to "submit", instead of "button"



Discussion

No Comment Found