View Single Post
  #2 (permalink)  
Old July 28th, 2003, 03:52 AM
pgtips pgtips is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

regular expressions are the way to go with this sort of thing, try
Code:
if ( /[^0-9]/.test(fn) ) { alert ("Please enter Numeric Value "); ... }
that will check whether the field contains any non-numeric characters, but it won't check for empty field, but this will:
Code:
if (!(/^\d+$/.test(fn)) ) { alert ("Please enter Numeric Value ");  }
Do you want to allow decimals, example 12.75?

rgds
Phil
Reply With Quote