Client-side validation for Number

Is there a way to validate (Client-side Javascript) if a user enters a number into a field?

Can you please show code example.

Subject: Found the Code

XSP.attachValidator(“#{id:age}”,null,new XSP.IntConverter(“Incorrect value entered. Please enter an integer”));