Open JavaScript
http://www.openjs.com/scripts/events/keyboard_shortcuts/
For certain keys (F1, F4), you have to open a new browser window without the address bar.
Example
Open a new window, without adornments:
window.open( 'webpage.html', 'TLA',
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=665' );
JavaScript to use the library:
var FALSE_FUNCTION = new Function( "return false" );
/**
* Called to disable F1, F3, and F5.
*/
function disableShortcuts() {
// Disable online help (the F1 key).
//
document.onhelp = FALSE_FUNCTION;
window.onhelp = FALSE_FUNCTION;
// Disable the F1, F3 and F5 keys. Without this, browsers that have these
// function keys assigned to a specific behaviour (i.e., opening a search
// tab, or refreshing the page) will continue to execute that behaviour.
//
document.onkeydown = function disableKeys() {
// Disable F1, F3 and F5 (112, 114 and 116, respectively).
//
if( typeof event != 'undefined' ) {
if( (event.keyCode == 112) ||
(event.keyCode == 114) ||
(event.keyCode == 116) ) {
event.keyCode = 0;
return false;
}
}
};
// For good measure, assign F1, F3, and F5 to functions that do nothing.
//
shortcut.add( "f1", FALSE_FUNCTION );
shortcut.add( "f3", FALSE_FUNCTION );
shortcut.add( "f5", FALSE_FUNCTION );
}
Inside webpage.html
:
<body onload="disableShortcuts();">
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…