title: javascript - detect ctrl key pressed or up, keypress event doesn't trigger
body: <p>I see some similar questions here (like <a href="https://stackoverflow.com/questions/6806271/javascript-check-if-ctrl-button-was-pressed">JavaScript: Check if CTRL button was pressed</a>) but my problem is actually the event triggering. My js code:</p>
  
  <pre><code>    // Listen to keyboard. 
      window.onkeypress = listenToTheKey;
      window.onkeyup = listenToKeyUp;
  
      /*
          Gets the key pressed and send a request to the associated function
          @input key
      */
      function listenToTheKey(e)
      {
          if (editFlag == 0)
          {
              // If delete key is pressed calls delete
              if (e.keyCode == 46)
                  deleteNode();
  
              // If insert key is pressed calls add blank
              if (e.keyCode == 45)
                  createBlank();
  
              if (e.keyCode == 17)
                  ctrlFlag = 1;
          }
      }
  </code></pre>
  
  <p>The event triggers for any other keys except the <kbd>ctrl</kbd>.<br>
  I need to also trigger it for <kbd>ctrl</kbd>.<br>
  I can't use jQuery/prototype/whatever so those solutions are not acceptable.</p>
  
  <p>So... how can I detect the <kbd>ctrl</kbd>?</p>