Success! WAS [thelist] function calculate()

Mona_Nisoff at bd.com Mona_Nisoff at bd.com
Tue Oct 24 17:09:35 CDT 2000


With your comments and some online searching, below is the resulting,
functioning  script that totals 12 specific form elements:

function grandTotal()
{
document.FrontPage_Form2.BdCostTotal.value =
parseInt(document.FrontPage_Form2.BdCostAdvertising.value*1) +
parseInt(document.FrontPage_Form2.BdCostLabor.value*1) +
parseInt(document.FrontPage_Form2.BdCostTravel.value*1) +
parseInt(document.FrontPage_Form2.BdCostDisposal.value*1) +
parseInt(document.FrontPage_Form2.BdCostWarehouse.value*1) +
parseInt(document.FrontPage_Form2.BdCostFreight.value*1) +
parseInt(document.FrontPage_Form2.BdCostRepackaging.value*1) +
parseInt(document.FrontPage_Form2.BdCostPostage.value*1) +
parseInt(document.FrontPage_Form2.BdCostPrintedMaterial.value*1) +
parseInt(document.FrontPage_Form2.BdCostProduct.value*1) +
parseInt(document.FrontPage_Form2.BdCostProfits.value*1) +
parseInt(document.FrontPage_Form2.BdCostSales.value*1)
}
---------------------- Forwarded by Mona Nisoff/RTP/BDX on 10/24/2000 11:01 AM
---------------------------


Mona_Nisoff at bd.com on 10/23/2000 10:44:57 AM

Please respond to thelist at lists.evolt.org

To:   thelist at lists.evolt.org
cc:    (bcc: Mona Nisoff/RTP/BDX)
Subject:  [thelist] function calculate()






Instead of getting a grand total in the BdCostTotal form field, I get an
appended answer.  Let's say I put the value
1 in BdCost Advertising field and 2 in the BdCost Labor field.  Instead of
getting 3, I get 12.  I tried adding "eval"
before each (document.Front...) and received a NaN response.

function calculate()
{
document.FrontPage_Form2.BdCostTotal.value =
((document.FrontPage_Form2.BdCostAdvertising.value) +
(document.FrontPage_Form2.BdCostLabor.value) +
(document.FrontPage_Form2.BdCostTravel.value) +
(document.FrontPage_Form2.BdCostDisposal.value) +
(document.FrontPage_Form2.BdCostWarehouse.value) +
(document.FrontPage_Form2.BdCostFreight.value) +
(document.FrontPage_Form2.BdCostRepackaging.value) +
(document.FrontPage_Form2.BdCostPostage.value) +
(document.FrontPage_Form2.BdCostPrintedMaterial.value) +
(document.FrontPage_Form2.BdCostProduct.value) +
(document.FrontPage_Form2.BdCostProfits.value) +
(document.FrontPage_Form2.BdCostSales.value))
}

If I'm asking elementary questions and you know of a list that would better suit
my level, please advise of such list.

Thank you.



---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !








More information about the thelist mailing list