SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Testing for NaN ...
-
Sep 24, 2007, 08:57 #1
- Join Date
- Jul 2003
- Location
- True North
- Posts
- 642
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Testing for NaN ...
Hello ...
How can I test if a value of a textbox is NaN ...
Thanks, Mike
-
Sep 24, 2007, 09:06 #2
- Join Date
- Apr 2006
- Posts
- 802
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
if(isNaN(textbox.value))alert(text box does not contain a number)
-
Oct 1, 2007, 11:01 #3
- Join Date
- Aug 2007
- Posts
- 50
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
isNaN Method
Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).
The isNaN function returns true if the value is NaN, and false otherwise. You typically use this function to test return values from the parseInt and parseFloat methods.
Alternatively, a variable could be compared to itself. If it compares as unequal, it is NaN. This is because NaN is the only value that is not equal to itself.
-
Oct 1, 2007, 11:23 #4
- Join Date
- Jul 2003
- Location
- True North
- Posts
- 642
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thats great ... thanks for the help guys.
Bookmarks