您如何在没有事件听众的情况下检查Capslock最初是否亮着?
我一直在查看的答案溢出问题,几乎只有大量答案显示出不同的方式来检查Capslock是否在开启,并有一些活动的侦听器。
在那些解决方案中,我发现我认为这是其中最好的一种,但是所有这些都有一个问题。它们都取决于某种输入(onkeyup
或单击
使用侦听器),我想(如果可能的话)检查该页面已加载页面以检查页面如果Capslock当前打开,然后使用我选择的解决方案,以检查Capslock状态在输入过程中是否更改。
这可能吗?
有什么方法可以使用event.getModifierstate
而无需event
?
I have been looking through the answers to this Stack Overflow question, and it is pretty much just a ton of answers showing different ways to check if CapsLock is on, with some event listener.
In those many solutions, I found one that I think is the best of them all, but there is one problem with all of them. They all depend on some sort of input (onkeyup
or click
listeners are used), I would like to (if possible) do a check the instant the page is loaded to check if CapsLock is currently on, and then use the solution I chose, to check if the CapsLock state changes during input.
Is this possible?
Is there some way that we can just use the event.getModifierState
without having an event
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论