Use regular expression, for example, /^[-+]?[0-9]*\.?[0-9]+$/. You may have to slightly adjust this to fit your specific needs. Your specific needs might be, for example: 1) Only accept numbers with two digits after decimal point; or 2) Accept 3. as a valid number and take it as 3.0.
Last edited by PeterPeiGuo; April 8th, 2010 at 09:36 AM..
|