Reply to Re: How to submit a form when user presses Enter key

Your name:

Reply:


Posted by bob on 01/18/08 11:52

radmission05@gmail.com ha scritto:
> 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>

This is HTML!
Whenever you type the ENTER key on a single <input> field you achieve a
SUBMIT as long as: a) the form has only that field; *or* b) the form has
an <input type="submit"> on it.

have fun!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация