Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

Determining if Numlock on or Off

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
sodakotahusker
Asked:
sodakotahusker
  • 3
  • 2
1 Solution
 
webwomanCommented:
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
 
sodakotahuskerAuthor Commented:
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
 
bebonhamCommented:
you want to tell which '.' key they pressed?

what if they only have one?

or three?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sodakotahuskerAuthor Commented:
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
 
bebonhamCommented:
oh well...

still...

I think it is a valid point.
0
 
bebonhamCommented:
would you be so kind as to share a little knowledge too?

what are you doing?

data entry?

game?

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now