M
mattgarvin
Hello,
I need a piece of javascript that will allow a form to be submitted
when Enter is pressed for IE6 and 7, Firefox 2, and recent versions of
Safari. It is for a login page that has two textboxes: a "Login" and
a "Password". The "Login Button" is actually a standard image with an
onClick event handler to submit the form, because we use a mouseover
effect. (That is, it is not INPUT TYPE="IMAGE" but rather an IMAGE
tag with onclick="document.forms[0].submit()" added.)
I found some code that works in IE, which is below, but it only works
in IE. I am sure there is a simple cross-browser fragment of
Javascript that will do the trick, so please point me in the right
direction.
Here is the code I am using that only works for IE.
....
<head>
<script type="text/javascript">
function handle_keypress(e)
{
if(window.event.keyCode==13)
{
delayed_submit_form()
}
else
return false;
}
</script>
</head>
<body onKeyPress="handle_keypress(event)">
....
Thanks for any help you can give me,
Matt Garvin
I need a piece of javascript that will allow a form to be submitted
when Enter is pressed for IE6 and 7, Firefox 2, and recent versions of
Safari. It is for a login page that has two textboxes: a "Login" and
a "Password". The "Login Button" is actually a standard image with an
onClick event handler to submit the form, because we use a mouseover
effect. (That is, it is not INPUT TYPE="IMAGE" but rather an IMAGE
tag with onclick="document.forms[0].submit()" added.)
I found some code that works in IE, which is below, but it only works
in IE. I am sure there is a simple cross-browser fragment of
Javascript that will do the trick, so please point me in the right
direction.
Here is the code I am using that only works for IE.
....
<head>
<script type="text/javascript">
function handle_keypress(e)
{
if(window.event.keyCode==13)
{
delayed_submit_form()
}
else
return false;
}
</script>
</head>
<body onKeyPress="handle_keypress(event)">
....
Thanks for any help you can give me,
Matt Garvin