JS Shortcut

Detectar combinacion de teclas

HTML

<script src="http://www.openjs.com/scripts/events/keyboard_shortcuts/shortcut.js"></script>
<h1>Detectar combinaci&oacute;n de teclas</h1>
<p>Primero haz clic en esta secci&oacute;n para que hacer foco, solo es necesario en este ejemplo en JSFiddle</p>
<p>Presiona F2 o Ctrl+G</p>

JavaScript

//Detectar combinacion de teclas
shortcut.add("F2", function () {
  alert("Tecla F2");
}, {
  "type": "keydown",
  "propagate": true,
  "target": document
});

shortcut.add("Fn+F11", function () {
  alert("Combinación de teclas Ctrl+G");
}, {
  "type": "keydown",
  "propagate": true,
  "target": document
});