views:

79

answers:

1

Hi, I made a form that works only with numbers, and I want alert the user when he type letters which are invalid alert he and delete the caracther or make the input box red ..., how can I make that?

A: 

Hi,

Don't let the user type anything else, if you dont want to.

You can observe the onkeypress-Event and check the charCode. If it's not a Number, simply return false.

Dr.Molle