Home >Web Front-end >JS Tutorial >JS sample code for blocking key effects and changing key effects_javascript skills
Function keys F1-F2: 112-123
a-b: 65-90
Number keys: 0-9: 48-57
ESC: 27
Backspace key: 8
Enter: 13
shift: 16; Ctrl: 17; Alt: 18
Space: 32
Insert: 45; Delete: 46
function MM_KeyPress(num){
//Prevent the system backspace key
var keycode = event.keyCode; if(keycode ==8)//Shield the backspace key
{
event.keyCode = 0;
//event.returnValue=false;
}
if(keycode >=112 && keycode <=123)//Shield f1 -12 function keys
{
event.keyCode = 0 ;
event.returnValue=false;
}
}