Detect keycode ALT+L via Javascript -


I want to find out that a user presses F12 or ALT + L.

  Documents. Onkeydown = function (event) {event = (event || window.event); If (event.keyCode == 123 || (event.keyCode == 18 and event.keyCode == 76)) {// anything wrong lies; }}  

What am I doing?

The standard way to indicate that 'alt' key is currently placed below and then To find out if it is true and if the L key is pressed - look at Bela:

var holds = false; ... and if (event.keyCode == 18) {organized = true;} if (organized == true & amp; event.keyCode == 76) {warnings}; } ... document.onkeyup = function (event) {if (event.keyCode == 18) {held = false;}}

To keep any combination of this key Applicable - You can create an array for multiple keys to hold more than two:

  organized = []; ... if (event.keyCode == i) {organized] [i] = true;} ...  

and so on


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -