Javascript examples for DOM:Key Event
Handle Key HIT/press event and check key code
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*w ww . ja v a2 s.c om*/ window.addEventListener('keypress', function(e) { e = e || window.event; switch(e.which) { case 77: if (e.ctrlKey) { console.log( "M + ctrlKey is down" ); // do some here } else { console.log("M is down") } break; } }, false); } </script> </head> <body> </body> </html>