Solved

Caps Lock Status

Posted on 2006-11-02
6
491 Views
Last Modified: 2012-05-05
hi experts,

I m doing my asp.net project using javascript.  I have one login page. Now i what i want is, When the caps lock key is on that time the tooltip should get display. Question is how to trace whether the Caps Lock is on or off? Is there any way in javascript to trace this?

Plz Help. It's urgent.

thanx
0
Comment
Question by:s_monani
6 Comments
 
LVL 12

Accepted Solution

by:
UnexplainedWays earned 168 total points
ID: 17857427
As far as i know there is no way to via javascript to find if the cap's lock is on, the only way i can think is to check when you get input if it's an upper or lower case.

So when something get's entered, check the data and get the ascii value of it.  If the letter is between a certain range then you can tell if it's upper or lower case, and if all the letters are upper they either have the shift key down or the cap's lock.

http://www.lookuptables.com for the numbers.
0
 
LVL 1

Assisted Solution

by:jsimbeck
jsimbeck earned 166 total points
ID: 17857949
I've not tried this, but it may be worth a shot.  
(not my own work, I found it at:  http://www.rgagnon.com/pbdetails/pb-0236.html


[local function declaration]
FUNCTION  int GetKeyState(int keystatus) LIBRARY "user32.dll"

[powerscript]
int li_keystate

li_keystate = GetKeyState(20)

IF li_keystate = 1 THEN
    MessageBox("", "CAPS on")
ELSEIF li_keystate = 0 THEN
    MessageBox("", "CAPS off")
END IF
0
 
LVL 6

Expert Comment

by:davbouchard
ID: 17860179
jsimbeck, that is not javascript and cannot be used for web development.

I will try to find something but, I would go with UnexplainedWays`s solution.
0
 
LVL 16

Assisted Solution

by:ellandrd
ellandrd earned 166 total points
ID: 17860234
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question