JRS: In article <GmBad.74338$a4 1.62715@pd7tw2n o>, dated Mon, 11 Oct
2004 19:42:30, seen in news:comp.lang. javascript, Terry Olson
<tw******@hotma il.com> posted :
I need to do a if statement on only textfields that have a number in them
other then zero. What is the best way to filter out all field values other
then numbers other then zero? I haven't had any luck, I know this should be
a simple thing, but I'm having a blonde day.
Firstly, you have to define zero.
Is 0.0e6 zero, or is it not?
Do you actually mean number, or do you mean digit? Many posters do not
discriminate.
Is there a number in "Daddy flew a B-36", and if so is it negative?
x = /[1-9]/.test(S) // Does S contain a digit other than zero?
Does "Pi11" contain a number?
Must the number be the only non-white-space? Does leading/trailing
white-space matter?
If you can say that the only characters to be allowed in the fields are
decimal digits, the question becomes much easier.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.