0

how to add the sum of them all

<script type="text/javascript"> 

function AddGuestCALC(){ 
newValue = (parseInt(document.formcheck.Price.value) * parseInt(document.formcheck.Guest.value)); 
document.formcheck.AddGuestTOTAL.value = newValue; 
} 

function MenuChange(){ 
newValue = parseInt(document.formcheck.Menu.value.asInt); 
document.formcheck.Price.value = newValue; 
}

function LechonCALC(){ 
newValue = parseInt(document.formcheck.Lechon.value) * 6500; 
document.formcheck.LechonTOTAL.value = newValue; 
} 

function AmmenitiesCALC(){ 
newValue = parseInt(document.formcheck.Total.value) + 10000; 
document.formcheck.Total.value = newValue; 
} 

function BridalCALC(){ 
newValue = parseInt(document.formcheck.Bridal.value) * 1500; 
document.formcheck.BridalTOTAL.value = newValue; 
} 

function CocktailCALC(){ 
newValue = parseInt(document.formcheck.Cocktail.value) * 5000; 
document.formcheck.CocktailTOTAL.value = newValue; 
} 

function SaladCALC(){ 
newValue = parseInt(document.formcheck.Salad.value) * 5000; 
document.formcheck.SaladTOTAL.value = newValue; 
} 

function DessertCALC(){ 
newValue = parseInt(document.formcheck.Dessert.value) * 5000; 
document.formcheck.DessertTOTAL.value = newValue; 
} 

function FishCALC(){ 
newValue = parseInt(document.formcheck.Fish.value) * 4500; 
document.formcheck.FishTOTAL.value = newValue; 
} 

function LightsCALC(){ 
newValue = parseInt(document.formcheck.Lights.value) * 3000; 
document.formcheck.LightsTOTAL.value = newValue; 
} 

function FlameCALC(){ 
newValue = parseInt(document.formcheck.Flame.value) * 3000; 
document.formcheck.FlameTOTAL.value = newValue;  

}

function EventLCALC(){ 
newValue = parseInt(document.formcheck.EventL.value) * 3500; 
document.formcheck.EventLTOTAL.value = newValue;

}  

function CorkageCALC(){ 
newValue = parseInt(document.formcheck.Corkage.value) * 6500; 
document.formcheck.CorkageTOTAL.value = newValue;
}


</script> 
2
Contributors
9
Replies
34
Views
4 Years
Discussion Span
Last Post by Shodow
0

simply make one javascript method.return the value after each methods above and then add it.
For eg:-

function CorkageCALC(){ 
newValue = parseInt(document.formcheck.Corkage.value) * 6500; 
document.formcheck.CorkageTOTAL.value = newValue;
return newValue;
}

then make a method and add all

function SumOfAllValue(){ 
document.formcheck.SumOfAllValue.value = CorkageCALC()+EventLCALC()+....
}
0

the sum wont show in the Total textbox

function Total()
{ 
document.formcheck.Total.value = AddGuestCALC()+LechonCALC()+BridalCALC()+CocktailCALC()+SaladCALC()+DessertCALC()+FishCALC()+LightsCALC()+EventLCALC()+CorkageCALC();
}
0

alert value and check the value of AddGuestCALC() before assigning value to check what value it is returning

0

Not sure thought but check this,

instead of

document.formcheck.Corkage.value

try this

document.formcheck.elements['Corkage'].value

and then alert value of it.There is problem in your above all javascript methods.Try the way i gave,then it might work.

0

after every javascript method,write alert to check if you are getting any value.
Press f12 in IE and start debugging your javascript by adding debug point.

Edited by IIM

This question has already been answered. 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.