Posted by radmission05@gmail.com on 10/07/08 12:00
On Jan 15, 11:04 am, Daniel Klein <dani...@featherbrain.net> wrote:
> I'm pretty new at php and web stuff so please be gentle with me.
>
> I'm trying to get a form to submit when the user presses the Enter
> key. I do not want to use javascript. I've googled this to death and
> cant find the answer (only hints), except on the 'Experts Exhange'
> page and you have to pay to get the answer :-(
>
> Why is this such a secret in the open source world we live in?
>
> Daniel Klein
check this
<script type="text/javascript">
function submit_form(frm)
{
if(event.key==13)
{
document.getElementById(frm).submit();
}
}
</script>
<form name="myform" id="myform" action="">
<input type="text" name="username" onkeydown="submit_form('myform')">
<input type="password" name="password"
onkeydown="submit_form('myform')">
<input type="submit" name="Submit" value="Submit">
</form>
[Back to original message]
|