ここで同様の質問がいくつか見られます ( JavaScript: CTRL ボタンが押されたかどうかを確認するなど) が、私の問題は実際にはイベントのトリガーです。私のjsコード:
// 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;
}
}
イベントは、. 以外の他のキーに対してトリガーされますctrl。
のトリガーも必要ですctrl。
jQuery/prototype/何でも使用できないため、これらのソリューションは受け入れられません。
だから...どうすれば検出できますctrlか?