Use JS to set shortcut keys for combination
The essence of using JS to set shortcut keys is to get the keycode value of the key you want to set, if you want to add ctrl,alt,shift, then added a ctrlkey,altkey,shiftkey to judge, so the key is to get the value of KeyCode.
(1) Set CTRL +enter Commit
if (e.ctrlkey && e.keycode = =) { 2 return submit (); 3}
(2) Set ALT + arrow key ← Submit
if (e.altkey&& E.keycode = = PNs) { 2 return3}
(3) Setting SHIFT+F10 submission
if (e.shiftkey&& E.keycode = = PNs) { 2 return submit (); 4}
(4) Set Enter submit
if (E.keycode = =) {2 return submit (); 3}
Some common shortcut keys for keycode:
1 KeyCode 8 =BackSpace BackSpace2 KeyCode 9 =tab TAB3 KeyCode 12 =Clear4 KeyCode 13 =Enter5 KeyCode 16 =shift_l6 KeyCode 17 =control_l7 KeyCode 18 =alt_l8 KeyCode 19 =Pause9 KeyCode 20 =Caps_lockTen KeyCode 27 =Escape EscapeKeyCode 32 =Space SpaceKeyCode 33 =PriorKeyCode 34 =NextKeyCode 35 =EndKeyCode 36 =HomeKeyCode 37 = Left38 KeyCode = upKeyCode 39 = RightKeyCode 40 = DownKeyCode 41 =SelectKeyCode 42 =PrintKeyCode 43 =ExecuteKeyCode 45 =InsertKeyCode 46 =DeleteKeyCode = Help
<script type= "Text/javascript" >
Call the Hotkey function when the onkeydown event occurs
$ ("#CarNo"). KeyDown (function (e) {
if (E.keycode = = 13)
{
Alert ("You press keyboard enter.");
}
});
</script>
Use JS to set shortcut keys for combination