Is it possible to check the status of Scroll Lock, Num Lock and Caps Lock on page load of a web page? I've found ways to check after a keypress using JavaScript, but that's not what I'm asking.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
No, you can't get system state from javascript. You will need them to type something and then analyze the input. Probably not what you wanted to hear =/
回答2:
IN 2019, this is now possible:
var x = event.getModifierState("ScrollLock");
Source: https://www.w3schools.com/jsref/event_mouse_getmodifierstate.asp