2012-06-29 32 views

回答

1

這將是一個javascript函數。看看onkeypress或onkeyup。

最好的選擇可能是jQuery的:

$(document).keyup(function(e) { 
    if (e.keyCode == x) { 
    //do something, i.e. alert('popup'); 
    } 
}); 

A few of the key codes: 
Enter  13 
Up arrow 38 
Down arrow 40 
Left arrow 37 
Right arrow 39 
Escape  27 
Spacebar 32 
Ctrl  17 
Alt  18 
Tab  9 
Shift  16 
Caps-lock 20 
Windows key 91 
Backspace 8 
Home  36 
End  35 
Insert  45 
Delete  46