-3

我想在我的图像上禁用系统键(例如,Win 键)?是否可以?

4

3 回答 3

1

我会说不。试试这个http://jsfiddle.net/XBHp7/

​$(document.body)​.keypress(function( e ){
     document.body.innerHTML += e.which + "<br/>";
});​

如您所见,浏览器中的网页不会将 windows 键识别为按键。

于 2012-05-10T15:35:50.717 回答
1
$(document).keydown(function(e){
    alert(e.keyCode); // replace "37" below with the windows key code
    if (e.keyCode == 37) { 
       alert( "windows key pressed" );
       return false;
    }
});
于 2012-05-10T15:36:04.467 回答
0

您可以检测这些击键(取决于浏览器),但不能阻止系统获取它们。

以下是标准键码列表,其中包含获取其他键码的机制:http: //www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes

例如在 Chrome/Ubuntu 上,我可以看到用户何时按下 win 键(我的系统上的代码 91),但不会阻止系统映射到它的操作。

于 2012-05-10T15:36:14.680 回答