AFAIK, the default action of the F1 key can be changed in any browser except IE. Microsoft teams are usually committed to maintaining a consistent user experience in their applications, and so F1 opens up help without returning false. There is a workaround in the form of a window.onhelp event.
// Internet Explorer if ("onhelp" in window) window.onhelp = function () { showMyHelpInsteadOfTheUsualDefaultHelpWindow(true); return false; } // Others else { document.onkeydown = function(evt) { cancelKeypress = (evt.keyCode == 112); if (cancelKeypress) { // F1 was pressed showMyHelpInsteadOfTheUsualDefaultHelpWindow(true); return false; } } // Additional step required for Opera document.onkeypress = function(evt) { if (cancelKeypress) return false; } }
The βotherβ step was adapted from a remote response, which was adapted from another answer , which, in turn, was adapted from another answer .
Andy E Aug 04 '10 at 12:30 2010-08-04 12:30
source share