...

View Full Version : PHP Keys



Nblufire12
12-16-2008, 09:03 PM
hey guys

can php access the keyboard?

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

eak
12-16-2008, 09:56 PM
You can get STDIN fom the user when using PHP CLI.
I'm not sure about capturing the key combination.

Google It (http://www.google.com/search?q=php+CLI+input)

Nblufire12
12-16-2008, 10:32 PM
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.

eak
12-16-2008, 11:31 PM
That would be done with javascript, not PHP.

Nblufire12
12-16-2008, 11:35 PM
Hmm i am totally newb with javascript, can I have an example?

194673
12-17-2008, 08:20 AM
Quick example:


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/702b8cd1-e5b0-42e6-83ac-25f0306e3e25/Javascript-Char-Codes-Key-Codes.aspx

Nblufire12
01-28-2009, 11:59 PM
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.

eu4ria
01-29-2009, 12:12 AM
replace
alert('enter pressed');
with whatever you want it to do, I think moving to a different location is

document.location = 'www.google.com';

Nblufire12
01-29-2009, 12:20 AM
Wow thanks alot

how do you scramble javascript?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum