Solved

Caps Lock Status

Posted on 2006-11-02
6
479 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!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

831 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