Determine whether you want to disable the global control or specify the control. If it is global, you only need to listen to the window. keyDownfunction (event ){.....} the same is true. If you are interested, you can check whether you want to disable global controls or specified controls. For example, if you only need to disable the up and down keys of a text box
The Code is as follows:
NoExec = function (event ){
Var k = event. which | event. keyCode;
If (k = 13 | k = 38 | k = 40 ){
If ($ ("# atWinByArea"). attr ("id ")){
If (event. which) {// Firefox
Event. preventDefault ();
} Else {// IE, Chrome
Event. returnValue = false;
}
}
}
DownAt (event );
}
Var target = document. getElementById ("saytext"); // the Id of the specified control.
If (target. addEventListener) {// bind the listener
Target. addEventListener ("keydown", NoExec, false );
Target. addEventListener ("keypress", NoExec, false );
} Else if (target. attachEvent ){
Target. attachEvent ("onkeydown", NoExec );
}
If it is global, you only need to listen to window. keyDown = function (event !~
Key Value Link corresponding to the keyboard