In a page, I have a table with user entering field.
There are 4 fields, first three are user entering fields and the fourth field is auto calculating of the first three fields,if the user leaves a field the total field showing NaN. How to solve this problem?

1 Year
Discussion Span
Last Post by diafol

NaN means not a number.

Solve this by showing us your code and we can then show you how to fix it.


Once again Antony, you lead off without showing your code. It seems we have to pry it out of you. Please, pretty please with sprinkles on top: show your code - you're more likely to get help. Describing the form says nothing. Where's the js? Ah, it's up to us to guess? Sorry if that sounds a bit sarcastic, but we really need to sort this out.

function calcTotal(a,i,j)
    c = parseInt(a);
    h = document.getElementById('Hvalue'+i).value;
    document.getElementById('Hvalue'+i).value = c;
    d = parseInt(h)+parseInt(a);
    document.getElementById('Hvalue'+i).value = d;

    document.getElementById('total'+i).value =  d;

    document.getElementById('stuid'+j).readOnly = true; 

Edited by AntonyRayan


Not sure what this is supposed to be doing.

Surely you just need to add the values?

Show your markup too. This is trying to get blood out of a stone Antony. Patience is a virtue but I'm running on empty.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.