Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32146

onkeyup in Firefox (was: onkeyup not working for me in FireFox 50.1.0)

Path csiph.com!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject onkeyup in Firefox (was: onkeyup not working for me in FireFox 50.1.0)
Date Mon, 09 Jan 2017 00:30:33 +0100
Organization PointedEars Software (PES)
Lines 73
Message-ID <7279249.NyiUUSuA9g@PointedEars.de> (permalink)
References <edfu3kFkfvbU1@mid.individual.net>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1483918235 20261 eJwFwYEBgDAIA7CX2CgtnoMg/59gEs7DFhhEbGyianS7xijXU3a6WHl3PpfBFdAEbjr8NfsBGx8QYw== (8 Jan 2017 23:30:35 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Sun, 8 Jan 2017 23:30:35 +0000 (UTC)
User-Agent KNode/4.14.2
Cancel-Lock sha1:UG8jCkmf8IK4lQ+zLk3JEPl9cBU=
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
X-User-ID eJwFwYkBwEAEBMCWOCzK8UT/JWTGBIxxhUHt7IK4wacVIMxnN/LeUYk+7jXKzlqXPeKXlmHinvFVYbZL+AdAPRUq
X-NNTP-Posting-Host eJwFwYkRwDAIA7CVeGxSxqnJsf8IkZjlNQfFApeLnLKeIaXQlSNZ8bOVt9c2owNHS32wCH8YkBCT
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Xref csiph.com comp.lang.javascript:32146

Show key headers only | View raw


Mel Smith wrote:

>     My onkeyup clause in my <input> element below works correctly under
> Chrome 54.0.2840.99

For suitable values of “correct”.
 
>     That is, when I receive a <return> character, I sense it, 'blur' the
> field, and then go thru the validation process by executing my validate()
> function. Tabbing also works correctly.

Do not do this.
 
>     However, when testing under Firefox 50.1.0, the onkeyup clause fails
>     to
> execute my chkforret function.  Apparently, I need to pass the 'event' as
> argument to the chkforret function instead of 'this' ??

Not necessarily.
 
> My essential question is then:
> 
>     Does onkeyup 'work' in Firefox ?

Yes, of course.  RTFM.
 
>      If so, what changes should I make to get it to work for me in the
>      code below so that Chrome and FF are both satisfied ?

Start from scratch and consume more caffeine this time.

> <input type="text"; onkeyup="chkforret(this);(gotret)?this.blur():false;"

BAD.  Broken as designed.

You are calling a user-defined *function* from an event-handler attribute 
value to set a *global variable*, that you subsequently access in the event-
handler attribute value – seriously?

The blur() call appears to be nonsense: If the Return key was released, you 
remove the focus from the control – to where?  If the released key is the 
Tab key or the Shift+Tab combination, you do not need to remove the focus 
manually, and UX-improving counter-measures of browser vendors (particularly 
Mozilla.org) will cause the call to be ignored.  If the released key is 
neither the Return key nor the Tab key, the user cannot enter more than one 
character in one attempt in that field – seriously?

The “false” there does not mean anything to the user agent if you do not 
return it to the event handler.  And you would not want to do that either 
(UX).

> onblur="setBlurColor(this);validate(this);"

Why setBlurColor()?

This is an instance where you want to add event listeners dynamically 
instead (because not all of those events might bubble in all target 
implementations).  The least you want to do is to handle the events at a 
common ancestor instead (in case they do bubble).

> id="ulotno" name="lotno"

Are there multiple controls with the same name?  If no, make ID and name the 
same in this case (this name is a Valid ID even in HTML < 5).  Omit the ID 
unless you are using it explicitly.

Finally, the name is _Firefox_.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

onkeyup not working for me in FireFox 50.1.0 "Mel Smith" <syntel@cox.net> - 2017-01-08 15:51 -0700
  onkeyup in Firefox (was: onkeyup not working for me in FireFox 50.1.0) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-09 00:30 +0100
    Re: onkeyup in Firefox (was: onkeyup not working for me in FireFox 50.1.0) "Mel Smith" <syntel@cox.net> - 2017-01-08 21:51 -0700
      Re: onkeyup in Firefox (was: onkeyup not working for me in FireFox 50.1.0) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-09 09:44 +0100
        Re: onkeyup in Firefox (was: onkeyup not working for me in FireFox 50.1.0) "Mel Smith" <syntel@cox.net> - 2017-01-09 10:26 -0700
          Re: onkeyup in Firefox (was: onkeyup not working for me in FireFox 50.1.0) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-09 19:19 +0100
      Re: onkeyup in Firefox Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-09 19:09 +0100

csiph-web