[Javascript] is numberic?? this is what I meant...thanks for your help and suggestions... you ROCK!!!!
Scott.Wiseman
swiseman at remax-cahi.com
Mon Jun 17 15:54:44 CDT 2002
function anyNumbers(str)
{
// Loop through and check for these numbers
var numbers=new Array("1","2","3","4","5","6","7","8","9","0");
str=str.toString();
var isbad1=true;
var sendback;
sendback="";
// loop through the string that was sent to this function
for(i=0; i<str.length; i++)
{
// test each element of the string against the array of numbers
for(j=0; j<numbers.length; j++)
{
// if we found a match, add to temp string to return back
if( str.substring(i,i+1)==numbers[j] )
{
j = numbers.length;
sendback = sendback + str.substring(i,i+1);
}
}
}
alert(sendback);
return sendback;
}
-----Original Message-----
From: Mckinney, Lori K [mailto:lkmckinn at ingr.com]
Sent: Monday, June 17, 2002 1:31 PM
To: javascript at LaTech.edu
Subject: RE: [Javascript] is numberic??
parseInt will give you back digits as long as it can. In your case, you
would get 11 for the parseInt value which is a number so isNaN is false.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/ht
ml/js56jsmthparseint.asp
The example from this reference is as follows:
parseInt("12abc") // Returns 12.
>
>I have tried the
>
>alert ( isNaN(parseInt(window.document.myform.RMList.value)) );
>
>to figure this out.
>
>but it will allow me to enter this "11dd44"
>this is not a number
>
>so what gives?
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list