Thursday, May 23, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  9] [ 3]  / answers: 1 / hits: 23071  / 11 Years ago, mon, april 1, 2013, 12:00:00

I'm trying to add some funds and I want to use Double.parseDouble but, I don't think the page is recognizing double.parseDouble. I don't get an error but it won't add or pass the values.



Here is my code.



function CalculateBudget(){
var table = document.getElementById('tblBudgetTotals');
input1600 = 0;
input1602 = 0;
input1603 = 0;
input1608 = 0;
input1612 = 0;
funding = 0;
budgetSum = 0;

input1600 = Double.parseDouble(document.getElementById('txt1600').value);
input1602 = Double.parseDouble(document.getElementById('txt1602').value);
input1603 = Double.parseDouble(document.getElementById('txt1603').value);
input1608 = Double.parseDouble(document.getElementById('txt1608').value);
input1612 = Double.parseDouble(document.getElementById('txt1612').value);
funding = Double.parseDouble(document.getElementById('FundingTotals').value);

budgetSum += Double.parseDouble(input1600) + Double.parseDouble(input1602) + Double.parseDouble(input1603) + Double.parseDouble(input1608) + Double.parseDouble(input1612) + Double.parseDouble(funding);

document.getElementById('totbud').value = Double.parseDouble(budgetSum);
}

More From » javascript

 Answers
19

I think you should just be using parseFloat for this, since according to these threads all numbers in JavaScript are already double precision (64-bit) floats.


[#79186] Sunday, March 31, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
yisroels

Total Points: 256
Total Questions: 94
Total Answers: 102

Location: Chad
Member since Mon, Dec 5, 2022
1 Year ago
;