admin管理员组文章数量:1024158
We can able to detect the Caps lock key is ON/OFF using Jquery. My question is
"can we possible to Turn ON/OFF the Caps lock key using Jquery or Javascript in Keypress event".
And also using C#, How to achieve this?
Thanks in advance !!!
We can able to detect the Caps lock key is ON/OFF using Jquery. My question is
"can we possible to Turn ON/OFF the Caps lock key using Jquery or Javascript in Keypress event".
And also using C#, How to achieve this?
Thanks in advance !!!
Share Improve this question edited May 10, 2012 at 13:12 yoozer8 7,4997 gold badges62 silver badges96 bronze badges asked May 10, 2012 at 13:08 Manikandan SethurajuManikandan Sethuraju 2,89310 gold badges32 silver badges48 bronze badges 2- 2 Nope. Javascript cannot interfere with the OS like that. – joshley Commented May 10, 2012 at 13:09
- If it can alter with OS then it will be very easy for programmer to make a virus in js which is not possible – user1432124 Commented May 10, 2012 at 13:11
4 Answers
Reset to default 4You 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();
}
}
}
You can't do this jquery like javascript will be sandboxed inside the browser.
Detection only:
$('#id').keypress(function(e) {
var s = String.fromCharCode( e.which );
if ( s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey ) {
alert('caps is on');
}
});
If this would be possible, then I would be able to control user's sound volume, or maybe check what he have in hard disk, I may be more curious and spy his network card traffic...
I would own the world with a simple JavaScript file :)
We can able to detect the Caps lock key is ON/OFF using Jquery. My question is
"can we possible to Turn ON/OFF the Caps lock key using Jquery or Javascript in Keypress event".
And also using C#, How to achieve this?
Thanks in advance !!!
We can able to detect the Caps lock key is ON/OFF using Jquery. My question is
"can we possible to Turn ON/OFF the Caps lock key using Jquery or Javascript in Keypress event".
And also using C#, How to achieve this?
Thanks in advance !!!
Share Improve this question edited May 10, 2012 at 13:12 yoozer8 7,4997 gold badges62 silver badges96 bronze badges asked May 10, 2012 at 13:08 Manikandan SethurajuManikandan Sethuraju 2,89310 gold badges32 silver badges48 bronze badges 2- 2 Nope. Javascript cannot interfere with the OS like that. – joshley Commented May 10, 2012 at 13:09
- If it can alter with OS then it will be very easy for programmer to make a virus in js which is not possible – user1432124 Commented May 10, 2012 at 13:11
4 Answers
Reset to default 4You 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();
}
}
}
You can't do this jquery like javascript will be sandboxed inside the browser.
Detection only:
$('#id').keypress(function(e) {
var s = String.fromCharCode( e.which );
if ( s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey ) {
alert('caps is on');
}
});
If this would be possible, then I would be able to control user's sound volume, or maybe check what he have in hard disk, I may be more curious and spy his network card traffic...
I would own the world with a simple JavaScript file :)
本文标签: cHow do i Turn ONOFF the Caps lock keyStack Overflow
版权声明:本文标题:c# - How do i Turn ONOFF the Caps lock key - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745581603a2157341.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论