Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #10370
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: How to set 'onKeyPress ...' programmatically ? |
| From | "Evertjan." <exjxw.hannivoort@interxnl.net> |
| References | <9np0guFpjtU1@mid.individual.net> |
| Message-ID | <Xns9FDEF353B131Deejj99@194.109.133.133> (permalink) |
| Date | 2012-01-18 22:55 +0000 |
Mel Smith wrote on 18 jan 2012 in comp.lang.javascript:
> Hi:
>
> Enviro: >50 input text fields
>
> Question: How does one set _programmatically_ in javascript, the
> onKeyPress event listener ??
>
> I tried a couple of statements (something like el.onKeyPress =
> myfunction() ; and "myfunction", etc, etc.
>
> Everything craps out and I don't know Where in my JavaScript Bible to
> look for the answer ??
>
> A Hint please ??
something like, [not tested]:
var inputs = document.forms[0].getElementsByTagName('input');
for (i=0;i<inputs.length;i++)
inputs[i].onKeyPress = myFunction;
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to set 'onKeyPress ...' programmatically ? "Mel Smith" <med_cutout_syntel@aol.com> - 2012-01-18 15:47 -0700
Re: How to set 'onKeyPress ...' programmatically ? "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-01-18 22:55 +0000
Re: How to set 'onKeyPress ...' programmatically ? "Mel Smith" <med_cutout_syntel@aol.com> - 2012-01-18 16:13 -0700
Re: How to set 'onKeyPress ...' programmatically ? Tim Streater <timstreater@greenbee.net> - 2012-01-18 23:25 +0000
Re: How to set 'onKeyPress ...' programmatically ? "Mel Smith" <med_cutout_syntel@aol.com> - 2012-01-18 16:31 -0700
Re: How to set 'onKeyPress ...' programmatically ? "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-01-18 23:39 +0000
Re: How to set 'onKeyPress ...' programmatically ? "Mel Smith" <med_cutout_syntel@aol.com> - 2012-01-18 16:53 -0700
Re: How to set 'onKeyPress ...' programmatically ? "J.R." <groups_jr-1@yahoo.com.br> - 2012-01-18 23:26 -0200
Re: How to set 'onKeyPress ...' programmatically ? Dr J R Stockton <reply1203@merlyn.demon.co.uk> - 2012-01-19 23:42 +0000
Re: How to set 'onKeyPress ...' programmatically ? "Mel Smith" <med_cutout_syntel@aol.com> - 2012-01-19 17:07 -0700
csiph-web