答案 0 :(得分:0)
我个人使用此列表:http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes 这是JS键盘事件的参考:http://unixpapa.com/js/key.html
答案 1 :(得分:0)
doube quote
的关键代码是 34 222(Mozilla,firefox,IE)类似的问题已经问过她:What are the JavaScript KeyCodes?
答案 2 :(得分:0)
如果您正在测试键入的字符(而不是检测不可打印的键击),那么您不需要查找表。使用keypress
事件,您可以在任何主要浏览器中获取事件中的字符代码和类型字符:
document.onkeypress = function(evt) {
evt = evt || window.event;
var charCode = (typeof evt.which == "number") ? evt.which : evt.keyCode;
if (String.fromCharCode(charCode) == '"') {
alert("Double quote typed");
}
};