コード:
$(document).keydown(function(key) {
switch (parseInt(key.which, 10)) {
case 65:
$('img[src*="imgs/A1.png"]').remove();
break;
case 83:
$('img[src*="imgs/S1.png"]').remove();
break;
case 68:
$('img[src*="imgs/D1.png"]').remove();
break;
case 70:
$('img[src*="imgs/F1.png"]').remove();
break;
case 74:
$('img[src*="imgs/J1.png"]').remove();
break;
case 75:
$('img[src*="imgs/K1.png"]').remove();
break;
case 165:
$('img[src*="imgs/Ñ1.png"]').remove();
break;
default:
alert("key not found");
break;
}
});
ユーザーが正しいキーを押した場合に、以前に追加した画像を削除したい。「通常の」文字では問題なく機能しますが、「Ñ」では機能しません。アスキー表によると、対応する番号は165ですが、動作しません(「Ñ」キーを押すと、「キーが見つかりません」と警告されます)。何か案は?前もって感謝します。