Regarding php!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Falconhearth
    New Member
    • Jan 2010
    • 1

    Regarding php!

    Hi,

    I wana ask how do I implement the code for Caps lock in php...forexampl e: if I wana login and capslock is On, whenever I type my login the msg or alert msg should prompt that capslock is On.so when I press caps lock again to make it caps lock off, then program should allow me to enter login name..

    Thx!
  • dgreenhouse
    Recognized Expert Contributor
    • May 2008
    • 250

    #2
    If the visitor can't see that they have the 'caps lock' on then they're probably not the kind of visitor you want! :-)

    Seriously, as far as I know you can't detect the "caps lock" state in php. I'm not even sure if you can do "caps lock" detection using php's in a command line based app - I've never bothered to try and discover. On the other hand, you can do it in JavaScript.

    Here's a link I found showing it implemented in JavaScript:

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Hm, I believe that JS only checks that the shift key is pressed.

      Anyway, with PHP being use typically as a server-side processor, for you to be aware of whether the caps-lock key is pressed, well, you'd have to pass that information to the server which defeats the point of PHP detecting it (not to mention you'd need to refresh the page / make an ajax call).

      However, if you were doing this as a desktop application with PHP as the driving-force behind it, you could write an extension to find the caps-lock-key's state. I may have a look into doing that now.

      Mark.

      Comment

      Working...