Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: PHP Keys

  1. #1
    Regular Coder
    Join Date
    Apr 2008
    Posts
    257
    Thanks
    15
    Thanked 0 Times in 0 Posts

    PHP Keys

    hey guys

    can php access the keyboard?

    like if Alt and N are pressed, then do this?

  • #2
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    You can get STDIN fom the user when using PHP CLI.
    I'm not sure about capturing the key combination.

    Google It
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

  • #3
    Regular Coder
    Join Date
    Apr 2008
    Posts
    257
    Thanks
    15
    Thanked 0 Times in 0 Posts
    I have seen it before, it might have been HTML or PHP,

    But some Online E-Mail services use it for Quick Hotkeys to Compose E-mails,

    For example, Gmail uses it.

  • #4
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    That would be done with javascript, not PHP.
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

  • #5
    Regular Coder
    Join Date
    Apr 2008
    Posts
    257
    Thanks
    15
    Thanked 0 Times in 0 Posts
    Hmm i am totally newb with javascript, can I have an example?

  • #6
    Regular Coder
    Join Date
    Dec 2006
    Posts
    166
    Thanks
    9
    Thanked 4 Times in 4 Posts
    Quick example:
    Code:
    document.onkeyup = function(e) {
      var key = e?e.which:event.keyCode;
      switch (key)
      {
      case 13:
        alert('enter pressed');
      break;
      default:
      break;
      }
    };
    Refer here for keycodes: http://www.cambiaresearch.com/c4/702...Key-Codes.aspx
    Last edited by 194673; 12-17-2008 at 07:41 AM.

  • #7
    Regular Coder
    Join Date
    Apr 2008
    Posts
    257
    Thanks
    15
    Thanked 0 Times in 0 Posts
    What exactly does that snippet of code do?

    I see that it alerts you if you press enter

    but if you press it, how can I make it LINK to another page

    so if i press enter, it goes to google.
    Last edited by Nblufire12; 01-28-2009 at 11:01 PM.

  • #8
    New Coder
    Join Date
    May 2006
    Posts
    81
    Thanks
    0
    Thanked 11 Times in 11 Posts
    replace
    Code:
    alert('enter pressed');
    with whatever you want it to do, I think moving to a different location is
    Code:
    document.location = 'www.google.com';

  • #9
    Regular Coder
    Join Date
    Apr 2008
    Posts
    257
    Thanks
    15
    Thanked 0 Times in 0 Posts
    Wow thanks alot

    how do you scramble javascript?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •