[Javascript] Adding values in input boxes

Scott Reynen scott at randomchaos.com
Thu Jun 1 09:00:52 CDT 2006


On Jun 1, 2006, at 8:54 AM, Alan Easton wrote:

> All I am trying to do, if the value is undefined, is set it to  
> zero, so that it does not break the adding up of the other value. I  
> just cannot seem to catch the undefined status and then set the  
> value to zero.......any ideas.......

I think you just need to change this:

  if ( x != 'NaN' )

To this:

if ( ! isNaN( x ) )

There seems to be a difference between a variable being NaN and a  
variable being the string of text composed of the characters N, a,  
and N.

Peace,
Scott




More information about the Javascript mailing list