Tacoma Tacoma - 22 days ago 11
HTML Question

Key sequence using event keys to load href

SOLVED VIA COMMENT charCode needed to be 3 which is ctrl+pause thanks Jaromanda X

So I have been through this site and can't seem to find what I am looking for. Currently I have the following for my JS. I am trying to make it work with ctrl+pause so it will load the TacomaSB.hta after pressing the key sequence ctrl+pause. If its already on the site please provide it but I couldn't seem to locate what I needed :L

<script>
function hrefKeyDown(evt)
{
var ev = ((window.event)?(window.event):(evt));
var ahref = document.getElementById('connect');
var charCode = ((window.event)?(window.event.keyCode):(((evt.which)?(evt.which):(evt.keyKode))));
if(charCode==19)
{
ahref.click();
}
}
</script>


Here is the body.

<body onkeydown="hrefKeyDown(event);return false;">
<a href="/TacomaSB.hta" onclick="document.login_form.submit(); return false;" name="connect" id="connect" onkeydown = "hrefKeyDown(event);return false;"></a>


At the moment I have it working fine with pause but I can't figure out how to do both charCode 19(pause) and charCode 17(ctrl)

Answer Source
Had to change the charCode to 3 was 19 solved via Jaromanda X
<script>

  function hrefKeyDown(evt)
 { 
var ev = ((window.event)?(window.event):(evt)); 
var ahref = document.getElementById('connect');
var charCode = ((window.event)?(window.event.keyCode):(((evt.which)?(evt.which):(evt.keyKode))));
if(charCode==3)
{ 
ahref.click();
} 
}
  </script>