4

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);
}
Leigh
  • 28,765
  • 10
  • 55
  • 103
tnlewis
  • 323
  • 1
  • 3
  • 15
  • Have you declared a `double` object that contains a `parseDouble` function? If not then I believe you may be looking for `parseFloat` as described here: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat – Chase Apr 01 '13 at 17:24
  • 1
    Is there any particular reason this question has a coldfusion tag? – Dan Bracuk Apr 01 '13 at 17:52

1 Answers1

13

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.

Community
  • 1
  • 1
metadept
  • 7,831
  • 2
  • 18
  • 25