NaN problem
Posted: Tue Mar 06, 2007 11:07 am
Hi there
I am getting a value from an xml using DOM in that manner.
i am trying then to print it on a textbox.
if i leave it as it is, the value in the textbox is 3,53 and not 3.53
if i try to make calculations with that number (tempInterest) and then print it to a textbox it shows NaN.
That i guess means that the value passes as String and not as double.
I tried this
and the number became 3 from 3,53
i tried this as well
and got NaN again
The thing is that in the xml i have the numbers as 3.45 3.12 etc not with commas ( , )
Why are they passed to tempInterest with commas?
I am getting a value from an xml using DOM in that manner.
Code: Select all
tempInterest = tempProg.getElementsByTagName("Interest")[0].childNodes[0].nodeValue;if i leave it as it is, the value in the textbox is 3,53 and not 3.53
if i try to make calculations with that number (tempInterest) and then print it to a textbox it shows NaN.
That i guess means that the value passes as String and not as double.
I tried this
Code: Select all
tempInterest = parseFloat(tempProg.getElementsByTagName("Interest")[0].childNodes[0].nodeValue);i tried this as well
Code: Select all
tempInterest = Number(tempProg.getElementsByTagName("Interest")[0].childNodes[0].nodeValue);The thing is that in the xml i have the numbers as 3.45 3.12 etc not with commas ( , )
Why are they passed to tempInterest with commas?
Code: Select all
<Program>
<Name>Program1</Name>
<Interest>3.53</Interest>
</Program>