在页面加载(或类似)上检测大写锁定状态 [英] detect caps lock status on page load (or similar)

查看:72
本文介绍了在页面加载(或类似)上检测大写锁定状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的研究中,我发现当按下大写键时如何检测大写锁定。但是,即使在未触摸密钥的情况下,我也想知道大写状态。

In my research, I've found how to detect capslock when the caps key is pressed. However, I want to know the caps status even in cases when the key is not touched.

示例:
alert(ui.Keyboard.capslock)//将返回true或false;

example: alert(ui.Keyboard.capslock) // would return true or false;

谢谢!

推荐答案

不,你无法在页面加载时获得键盘按钮的状态。你必须分析一个按键的keyCode。这是唯一的方法。

No, you cannot get the state of a keyboard button on page load. You have to analyze a keyCode of a keypress. That is the only way.

这篇关于在页面加载(或类似)上检测大写锁定状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆