Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] [Javascript] enabling/disabling buttons: enter key
- Date: Sat, 26 Feb 2011 13:15:03 +0900
- From: Dave M G <dave@example.com>
- Subject: Re: [tlug] [Javascript] enabling/disabling buttons: enter key
- References: <4D6677FE.4090307@example.com> <871v2xe88k.fsf@example.com>
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7
TLUG, Stephen, After a little digging I now realize that the problem isn't the button, it's the text field. Apparently, unless you specify to disable the enter key in a text field, then it's possible to trigger to send the form data with the enter key. So it wasn't that the button was being triggered, it was that the form data was being sent, and that made it look to me like the button was being pressed. I think what I want to do, then, is globally deactivate enter keys on text boxes, because I always want to do specific Javascript when the appropriate buttons are pressed. I think this code I found on the web* might do it: function stopRKey(evt) { var evt = (evt) ? evt : ((event) ? event : null); var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if ((evt.keyCode == 13) && (node.type=="text")) {return false;} } document.onkeypress = stopRKey; Will have to experiment. * http://www.webcheatsheet.com/javascript/disable_enter_key.php -- Dave M G
- References:
- [tlug] [Javascript] enabling/disabling buttons: Japanese text and enter buttons
- From: Dave M G
- [tlug] [Javascript] enabling/disabling buttons: Japanese text and enter buttons
- From: Stephen J. Turnbull
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] [Javascript] enabling/disabling buttons: Japanese text
- Next by Date: Re: [tlug] Do you whitelist or blacklist utf-8?
- Previous by thread: [tlug] [Javascript] enabling/disabling buttons: Japanese text and enter buttons
- Next by thread: Re: [tlug] [Javascript] enabling/disabling buttons: Japanese text and enter buttons
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links