Jump to content

[SOLVED] NaN and Undefined in Javascript


ainoy31

Recommended Posts

Hello-

 

I have a form the calculates the total dimension weight and chargeable weight.  However, these two fields are calculated base on what is entered prior.  So, as I enter my measurements, in the total dimension and chargeable fields I see NaN and undefined pop up.  However, once I finish entering all my measurements, NaN and undefined goes away and displays the correct results.  Does anyone know a fix for this?  Much appreciation.  AM

Link to comment
https://forums.phpfreaks.com/topic/80677-solved-nan-and-undefined-in-javascript/
Share on other sites

Nevermind.  I fixed my issue.  The problem was that I was passing in the var result where I am calculating the total.  First, I needed to check to see is the var result was null or not.  If is was, I need to set my total dimension value to 0.

 

if(result == null)

{

document.getElementById('tot_dim').value = '';

....and so on.

 

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.