0

この典型的な状況でBackspace、ナビゲーションを元に戻すことができないという問題があります。しかし、私が思うに違いがあります。

それは私の焦点を合わせたオブジェクトのonKeyDown機能です。(もちろん多少の変更はあります)

function(key) // Key is the pressed key code
{
   return key != 8;     
};

上記の関数は正しく実行されますが、以下の関数は実行されません。

function(key) // Key is the pressed key code
{
    wnd.onKeyDown(key);
return key != 8;        
};

wndはオブジェクトとそのonKeyDown機能です:

this.onKeyDown = function(key)
{
    if (key == 37)
        this.charInd = Math.max(0, this.charInd-1);
    else if (key == 39)
        this.charInd = Math.min(this.string.length-1, this.charInd+1);
    else if (key == 8)
    {
        this.string.splice(this.string.length-1, 1);
        this.charInd--;
    }
};

ナビゲートを防ぐために、フォーカスされたオブジェクトの関数を送信することだけが重要ではありませんtrueか?falseonKeyDown

4

0 に答える 0