9

【代码】网页上添加快捷键

 2 years ago
source link: https://feiju12138.github.io/2022/10/02/%E7%BD%91%E9%A1%B5%E4%B8%8A%E6%B7%BB%E5%8A%A0%E5%BF%AB%E6%8D%B7%E9%94%AE/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

网页上添加快捷键

添加快捷键

控制键:当被按住时返回true,没有被按住时返回false

event.metaKey:徽标键(Windows上的win键,MacOS上的command键)
event.ctrlKey:ctrl键
event.altKey:alt键
event.shiftKey:shift键
<keycode>键盘编码值

document.body.onkeydown = function (event) {
if (event.metaKey && event.keyCode === <keycode>) {
console.log(event);
}
}

CSDN——爱划水de鲸鱼哥~


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK