我如何打开/关闭大写锁定键 [英] How do i Turn ON/OFF the Caps lock key

查看:166
本文介绍了我如何打开/关闭大写锁定键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以使用Jquery检测到Caps Lock键处于打开/关闭状态. 我的问题是

We can able to detect the Caps lock key is ON/OFF using Jquery. My question is

能否在Keypress事件中使用Jquery或Javascript打开/关闭Caps Lock键".

"can we possible to Turn ON/OFF the Caps lock key using Jquery or Javascript in Keypress event".

还要使用C#,如何实现呢?

And also using C#, How to achieve this?

提前感谢!!!

推荐答案

您无法更改大写锁定键是打开还是关闭.但是,您可以根据大写锁定键是打开还是关闭来更改Java脚本的输入字符串是小写还是大写.

You can't change whether the caps lock key is on or off. You can however change whether your input strings are lower or upper case with Javascript based on whether the caps lock key is on or off.

for (char in inputString) {
    if(capslock) { // do your caps lock detection here
        if(char === char.toUpperCase()) { // it's upper case
            char = char.toLowerCase();
        } else {
            char = char.toUpperCase();
        }
    }
}

这篇关于我如何打开/关闭大写锁定键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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