📜  在 javascript 代码示例中捕获击键

📅  最后修改于: 2022-03-11 15:02:34.230000             🧑  作者: Mango

代码示例1
window.onload = function() {
   document.getElementsByTagName('body')[0].onkeyup = function(e) { 
      var ev = e || event;
      if(ev.keyCode == 70) {//&& ev.ctrlKey) {
         //do something...
      }
   }
};