Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #10372
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: How to set 'onKeyPress ...' programmatically ? |
| Date | 2012-01-18 23:25 +0000 |
| Organization | Personal Software |
| Message-ID | <timstreater-FEC2D1.23251318012012@news.individual.net> (permalink) |
| References | <9np0guFpjtU1@mid.individual.net> <Xns9FDEF353B131Deejj99@194.109.133.133> <9np21iF4v2U1@mid.individual.net> |
In article <9np21iF4v2U1@mid.individual.net>,
"Mel Smith" <med_cutout_syntel@aol.com> wrote:
> ************* my original code *******
> function setonpress() {
> var el ;
> var inputs = document.getElementsByTagName("input") ;
>
> // now we have to add a keypress function to each of them
> for (var i=0;i<=inputs.length;i++) {
> el = inputs[i] ;
> if (el.type === "text") {
> window.alert("type of el.onKeyPress = "+ typeof el.onKeyPress) ; //
> always results in 'undefined'
Well you've not added it yet, have you?
> // I wish the focusOnElement function to be 'planted' in each of my
> 50+ text fields
> // and I don't what to have to type them in.
> el.onKeyPress = focusOnElement ; // so this craps out :((
What do you mean by "craps out"?
> return true; // get out on 1st field for testing purposes. //
> I leave quickly while testing
> } ;
> }
> }
>
> *******************************
--
Tim
"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
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