Solved

Determining if Numlock on or Off

Posted on 2001-06-25
6
319 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

760 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

19 Experts available now in Live!

Get 1:1 Help Now