0

Hi I am new in PHP. I have one query is it possible to give short cut keys like f1, f2 etc.. for saving data, opening any page directly by pressing button. please reply me, I am waiting

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by keval_hack
0

Most of the function keys are already reserved by the browser for other tasks. So if you assigned an action to, for example, the F5 key, you'll end up refreshing the browser window.

It may be possible to stop the default behavior of the button -- I'm not sure. Regardless, what you are looking for is in the domain of JavaScript, not PHP, since PHP takes place on the server-side, whereas button presses are client-side. You may want to look into jQuery. The event.preventDefault() may help you accomplish your goal. Keep in mind that:
1) users may get annoyed if you take away their ability to use the function key shortcuts for what they are intended for by the browser, and
2) users on browsers that do not support JavaScript or that have JavaScript turned off will not be able to use these shortcuts.

I hope that helps.
- EF

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.