JavaScript, Detecting KeyUp or KeyDown KeyCode

  • From: "RicksPlace" <ofbgmail@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 22 Jul 2009 11:12:31 -0400

Hi: Well, it never ends...
In my JS routine I want to detect some special key to use as a hot key to pop 
up an alert box when pressed. Reading up on the topic it seems that various 
browsers recognize diferent keys for the same key when pressed. Has anyone used 
Key detection in a JavaScript routine that uses a key that would not normally 
be used for normal data entry? The fx keys do not generate a KeyPress but I'm 
not sure about KeyUp and KeyDown in the various browsers. Or, do you have a 
diferent idea of how to tell a user how many characters they have entered in a 
TextBox from the client-side?
A label control would require tabbing out of the TextBox and back in, not 
smooth and resetting focus to the last character typed in the TextBox might be 
tricky when tabbing back in, I'm not sure. I have everything working but now 
need some way to trigger the JS Alert box only on a user request or on 
exceeding the max length allowed for the TextBox. Any ideas?
Rick USA

Other related posts: