Solved

Determining if Numlock on or Off

Posted on 2001-06-25
6
324 Views
Last Modified: 2012-05-04
I'm doing keypress validations.  I have found how to check for Shiftkey, alt key and ctrl key being pressed but now I need to allow users to use the numerical keypad.  I have to know if the numlock is on or off when a key comes through.  Can anyone tell me how to determinate that with javascript???
  Thanks!!!
   
0
Comment
Question by:sodakotahusker
  • 3
  • 2
6 Comments
 
LVL 19

Accepted Solution

by:
webwoman earned 25 total points
ID: 6225332
I doubt you can. It's not a keypress, not if it's already on.

However, does it matter? If they're using the numeric keypad, and they DON'T have numlock on, they won't input a number. If you're checking for numbers, do you care where they came from?
0
 
LVL 1

Author Comment

by:sodakotahusker
ID: 6225657
Yes I care if I only have the numeric representation of the keystroke.  If the user presses the decimal point on the keyboard it fires code 46.  If they press the decimal point on the numeric keypad it fires 190 if they have numlock on.  If they don't - it fires 46.  How do I tell the difference between 46 and 46?????
     
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6225666
you want to tell which '.' key they pressed?

what if they only have one?

or three?
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 1

Author Comment

by:sodakotahusker
ID: 6225691
Oops.  The decimal point on the keyboard returns 190.  With numlock returns 110.   Without numlock returns 46.  
No issue here.  Sorry for the false alarm.  
    Thanks for forcing me to recheck my original findings.  
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6225880
oh well...

still...

I think it is a valid point.
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6225885
would you be so kind as to share a little knowledge too?

what are you doing?

data entry?

game?

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

813 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now