Follow by Email

Wednesday, November 20, 2013

javascript capture ctrl+key


Using below Javascript snippet you can trigger things in your web application based on key combinations
 

  /*http://stackoverflow.com/questions/2878983/capture-key-press-without-placing-an-input-element-on-the-page*/  

  document.onkeydown = function(evt) {

          evt = evt || window.event;

          //ctrl+caps

          if (evt.ctrlKey && evt.keyCode == 20 ) {

             

              //**Open a new tab and shift the focus to it

              window.open('url to your page','_blank');

              win.focus();

          }

      };

 

The below website can be used to look for the key codes

No comments:

Post a Comment