![]() Topic awaiting preservation: js caps lock detection (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: California |
![]() Hi there, code: <script type="text/javascript"> function capsLock(e){ if(e.which==20) alert("Caps Lock"); } document.onkeypress=capsLock; </script> |
Obsessive-Compulsive (I) Inmate From: |
![]() You can't detect it correctly; in fact, as far as I'm aware, nothing at all in software can detect Caps Lock, because the keyboard handles it itself and just sends capital letters. Checking for capitals without shift is a good (and the only) way to do it. |
Paranoid (IV) Inmate From: 127.0.0.1 |
![]() |
Nervous Wreck (II) Inmate From: California |
![]() |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
![]() What you can do actually is when someone enters a text field, determine whether the shift key is down when they type. If the characters are upper case and the shift key isn't pressed then it means the caps lock is on. |
Nervous Wreck (II) Inmate From: Here, there and everywhere |
![]() I'm pretty sure your computer does know if Caps Lock is on. In Microsoft Word, pressing that key displays CAPS in the corner...somewhere. I think. I don't see it right now, but I'm sure I've seen it do that before. |
Nervous Wreck (II) Inmate From: California |
![]() |
Bipolar (III) Inmate From: London |
![]() quote:
|