pacome Posted May 11, 2007 Share Posted May 11, 2007 Hi! Is it possible to assign tasks to the F1 F2 keys of the keybord with PHP? thanks for your time! Quote Link to comment https://forums.phpfreaks.com/topic/50947-f1-f2-f3-etc/ Share on other sites More sharing options...
redbullmarky Posted May 11, 2007 Share Posted May 11, 2007 that'd be a javascript thing, if anything... Quote Link to comment https://forums.phpfreaks.com/topic/50947-f1-f2-f3-etc/#findComment-250640 Share on other sites More sharing options...
StormTheGates Posted May 11, 2007 Share Posted May 11, 2007 PHP is server side, it will only do things when stuff goes to your server. When you hit f1 f2 f3 you are sending stuff to your browser and your own computer, not the server. So no, there isnt. Thats JS only. Quote Link to comment https://forums.phpfreaks.com/topic/50947-f1-f2-f3-etc/#findComment-250650 Share on other sites More sharing options...
taith Posted May 11, 2007 Share Posted May 11, 2007 no... javascript only has access to the standard buttons... you cant access F1-12 through document.onkeydown... Quote Link to comment https://forums.phpfreaks.com/topic/50947-f1-f2-f3-etc/#findComment-250656 Share on other sites More sharing options...
pacome Posted May 11, 2007 Author Share Posted May 11, 2007 any ideas how to?? Quote Link to comment https://forums.phpfreaks.com/topic/50947-f1-f2-f3-etc/#findComment-250741 Share on other sites More sharing options...
redbullmarky Posted May 11, 2007 Share Posted May 11, 2007 javascript would be the only way. so if javascript can't do it - then you're out of luck. many of the function keys are hard programmed into the browser (eg, F3 for search, F5 for refresh) - so even if it was possible, many people (myself included) wouldn't be a fan of anything that removed "the norm" behaviour. try access keys instead, with the accesskeys using the regular numbers. eg <a href="home.php" accesskey="1">Home page</a> Quote Link to comment https://forums.phpfreaks.com/topic/50947-f1-f2-f3-etc/#findComment-250754 Share on other sites More sharing options...
Psycho Posted May 11, 2007 Share Posted May 11, 2007 The only solution I can think of would be to create a java applet. Of course, that would require the user to authorize the download and installation of said component. Quote Link to comment https://forums.phpfreaks.com/topic/50947-f1-f2-f3-etc/#findComment-250766 Share on other sites More sharing options...
pacome Posted May 11, 2007 Author Share Posted May 11, 2007 you see, it's for a small game I'm programming for myself and some colleagues from work, so changing the normal use of the F keys will be acceptable... if anyone is interested (though I know it's not php) I found this while surfing: <SCRIPT language="JavaScript"> function keyTest() { var key=window.event.keyCode;//key code. switch(key) { case 112: window.location="www.google.es"; break; case 113: window.location="www.yahoo.com"; break; case 114: window.location="www.gmail.com"; break; //etc, etc... } return false; } </SCRIPT> <body OnKeyDown="JavaScript:keyTest();" > I think it just does the job... thanks again for your help in directing me to JavaScript! Quote Link to comment https://forums.phpfreaks.com/topic/50947-f1-f2-f3-etc/#findComment-250772 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.