Cless Posted October 12, 2008 Share Posted October 12, 2008 Is there a way to make it so, whenever a user presses a certain key (such as the down key), it submits a button? For example, I have this code: <input type='submit' value='Submit'> Whenever somebody presses the "down" key, I want it to submit. Is there a way to do this? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/128094-key-presses/ Share on other sites More sharing options...
haku Posted October 12, 2008 Share Posted October 12, 2008 javascript: onkeypress Quote Link to comment https://forums.phpfreaks.com/topic/128094-key-presses/#findComment-663340 Share on other sites More sharing options...
F1Fan Posted October 13, 2008 Share Posted October 13, 2008 You'll also need the keyCode for the key(s) you want to activate your code: http://www.w3schools.com/jsref/jsref_onkeypress.asp "40" is the event code for the down arrow. Here's a complete keyCode reference: http://www.cambiaresearch.com/c4/702b8cd1-e5b0-42e6-83ac-25f0306e3e25/Javascript-Char-Codes-Key-Codes.aspx Quote Link to comment https://forums.phpfreaks.com/topic/128094-key-presses/#findComment-664031 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.