[英]JS keycodes not the same as websites say?
當我查看顯示JS密鑰代碼的任何網站時,我看到f#按鈕為112-123,即為83。但是,我將我的網站console.log()設為了我按下的鍵的密鑰, “ s”顯示為115。f#鍵根本不顯示。 有人可以幫忙嗎?
代碼只是
body.addEventListener('keypress', function() {
var x = event.keyCode;
console.log(x);
});
您需要考慮大小寫。 S
是83. s
是115。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.