Path: csiph.com!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Interrogation of Shift-Key state Date: Sat, 25 Jun 2016 20:07:33 +0200 Organization: PointedEars Software (PES) Lines: 25 Message-ID: <18572732.4csPzL39Zc@PointedEars.de> References: <2962054.LZWGnKmheA@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1466878056 699 eJwFwYEBwCAIA7CXEGmZ52AZ/59ggs1FZRAMDCY0/7VvZ2WhrrriiGn7ZDtPqK048NVQeeoBLZERjA== (25 Jun 2016 18:07:36 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 25 Jun 2016 18:07:36 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwQcBACAIBMBKMh4wjqz+EbyDGFm5Gkyx2JHQVlunl5no4RlcEj63hDMArTTb9SVB9cFMnC4hj1fJH2DzFfA= Cancel-Lock: sha1:ErvoR8OQGChQfQ1iRtnF3uFePRk= X-NNTP-Posting-Host: eJwNyMEBwCAIA8CVhJIo6zSS/Udo73l4GNQuggXDL904e/kuZMyFHKgY9pnUfzmcltyKRvEDGUcQ5w== Xref: csiph.com comp.lang.javascript:30731 Janis Papanagnou wrote: > On 25.06.2016 17:18, Thomas 'PointedEars' Lahn wrote: >> Janis Papanagnou wrote: >>> My application context is a function that is triggered when a button is >>> pressed. Is there a simple way to just interrogate the Shift-Key status >>> in that function? >> Yes. > > How? In the W3C/WHATWG DOM, an event listener is passed a reference to the event object as first argument (if you need to support the legacy MSHTML DOM as well, you need to read the “window.event” property instead). Event objects have a “shiftKey” property whose value is “true” if the Shift key was pressed when the event was fired, “false” otherwise. And you can pass the property value to your function. HTH -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.