My page has two forms. One is a normal login form, the other is for creating account and appears in a modal box. I used Javascript (below) to have the enter key submit the “create account” form, and it works great. for some reason, however, the exact same code used in the exact same manner won’t work for the login form. Can anyone explain this to me?
I used this script:
<script>function checkSubmit(e)
{
if(e && e.keyCode == 13)
{
document.forms[0].submit();
}
}
</script>
and I implemented it in a link like this:
<a href="editprofile.php" onclick="document.createfrm.submit()" onKeyPress="return checkSubmit(event)" id="submitcreate">
when I enter the “onKeyPress” stuff in a similar link for the login form, it doesn’t work. Thanks for any help in advance.
This should work: