Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

keycode to disable the shift key??

Status
Not open for further replies.

WB786

MIS
Mar 14, 2002
610
I have all of the keys disabled except for the number keys and period. But the user is able to hold down the shift key and type a % symbol, etc. I don't want any other characters in this field except for numbers and a period.

I am using event.keycode to check for non numeric keys and then disabling them. I am calling the even using OnKeyDown.

What do I need to add to this function in javascript to disable both of the shift keys.

Thanks,

:)WB
 
Some of the symbols such as % are considered numeric. I would check the ASCII Code to see if the values are between 48 and 57 or 46 for the period.

Hope this helps.

Hope everyone is having a great day!

Thanks - Jennifer
 
You could also just check if the string (or the last character) contains any illegal characters and if so truncate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top