[Javascript] Is Numeric Function
flavio
flavio at economisa.com.br
Fri Feb 20 10:47:34 CST 2004
Well.. about the question I'm also not so sure if is that what you want, but
I believe you need the function to "return true" is the string is empty, right?
(or not?? LOL)
If is that it you just have to change the
> if(passedVal == "")
> {return false;}
to
> if(passedVal == "")
> {return true;}
Hope to help
--
Flavio Gomes
flavio at economisa.com.br
Quoting Peter Brunone <peter at brunone.com>:
> Hi Uri,
>
> I'm not exactly sure what you're asking in your first question,
> but to replace in Javascript, you should be able to use
>
> myString.replace(" ", "-");
>
>
> Cheers,
>
> Peter
>
> -----Original Message-----
> From: javascript-bounces at LaTech.edu On Behalf Of Grinwald, Uri
>
> Hi List Members.
>
> I have a function that checks for numbers:
> It won't allow for space, so I need to either reflect that an empty
> character is allowed within the function.
>
> On a separate use of this function how can I replace any empty spaces
> with a "-"
> Here is my function at the top of page.
> I call all my validations further down with a validate(obj) function.
>
>
> function IsNumeric(passedVal)
>
> {
>
> var ValidChars = "0123456789.()-";
> var IsNumber=true;
> var Char;
> if(passedVal == "")
> {return false;}
> for (i = 0; i < passedVal.length && IsNumber == true; i++)
> {
> Char = passedVal.charAt(i);
> if (ValidChars.indexOf(Char) == -1)
> {
> IsNumber = false;
> }
> }
> return IsNumber;
>
> }
>
> ////and later I do the following...
> if(!IsNumeric(obj.dynTelEng_11.value))
> {
> msgError = msgError + '\n' + 'Telephone Number must be numeric';
> }
>
> Etc...
>
> Any help would be greatly appreciated.
> Uri
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
---------------------------------------------------------------------
Mensagem enviada através do WebMail NetSol (http://www.netsol.psi.br)
More information about the Javascript
mailing list