jjzjj

KeyboardEvent

全部标签

javascript - 在 JS/jQuery 中绑定(bind)箭头键

如何在Javascript和/或jQuery中将函数绑定(bind)到左右箭头键?我查看了jQuery的js-hotkey插件(包装了内置的绑定(bind)函数以添加参数以识别特定键),但它似乎不支持箭头键。 最佳答案 document.onkeydown=function(e){switch(e.which){case37://leftbreak;case38://upbreak;case39://rightbreak;case40://downbreak;default:return;//exitthishandlerforot

javascript - 在 JS/jQuery 中绑定(bind)箭头键

如何在Javascript和/或jQuery中将函数绑定(bind)到左右箭头键?我查看了jQuery的js-hotkey插件(包装了内置的绑定(bind)函数以添加参数以识别特定键),但它似乎不支持箭头键。 最佳答案 document.onkeydown=function(e){switch(e.which){case37://leftbreak;case38://upbreak;case39://rightbreak;case40://downbreak;default:return;//exitthishandlerforot
12