Jump to content

Issue in Displaying NaN values


newphpcoder

Recommended Posts

Hi..

 

I created a function and I encountered problem because I got a NaN values. And I want to resolve it..I don't want to display NaN values. instead of NaN I just want it blank.

 

here is my code:

function doz(oText){
    var P27_max = document.getElementById("P27_max").value;
    var P27_max_convert = parseFloat(P27_max) + parseFloat(1);   
    var P27_maxdoz = document.getElementById("P27_maxdoz").value = P27_max_convert;
    
    
    var P28_max = document.getElementById("P28_max").value;
    var P28_max_convert = parseFloat(P28_max) + parseFloat(2);
    var P28_maxdoz = document.getElementById("P28_maxdoz").value = P28_max_convert;
}

 

when I entered data in

P27_max so the P27_maxdoz was computed but the problem is the P28_max has also value 'NaN'.

 

How can I eliminate or did not display NaN

 

Thank you

 

 

Link to comment
Share on other sites

I resolved it using this code:

 

    var P45_min = document.getElementById("P45_min").value;
    var P45_min_convert = parseFloat(P45_min) + parseFloat(13);
    if( !isNaN(P45_min_convert) ){
    var P45_mindoz = document.getElementById("P45_mindoz").value = P45_min_convert; 
    }

 

Thank you

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.