Topic awaiting preservation: js caps lock detection (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: California |
posted 07-24-2005 22:48
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: |
posted 07-25-2005 02:04
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 |
posted 07-25-2005 18:05 |
Nervous Wreck (II) Inmate From: California |
posted 07-25-2005 18:48 |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 07-25-2005 20:47
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 |
posted 07-25-2005 22:56
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 |
posted 07-27-2005 21:06 |
Bipolar (III) Inmate From: London |
posted 07-30-2005 12:00
quote:
|