so i have made a simple price quote script with the basic knowledge (very basic) i have taught myself and i would like to add some more stuff to it...
here is the price quote code on jsfiddle
i have check boxes but they have no script attached to them and i would like to add a value to be added to to the total when the checkbox is check...i found a code for a simple checkbox
function initialize() {
Total = 0;
totalprice.innerText = Total;
}
function checkoption(checkbox) {
checknum = parseInt(checkbox.value);
if (checkbox.checked == true) {
Total += checknum;
} else {
Total -= checknum;
}
totalprice.innerText = Total;
}
How do i get the value created from these two functions (it being 0 if no check boxes are selected) and use it in the calculate function...do i parsefloat something? in this example code is the value Total? and lastly do the functions run in order from top to bottom...therefore these two example functions should go on top of function calculate?
ive been trying different things and can seem to find what to do :S....
varotherwise you're polluting the global scope, which is not a good idea...varensures that the variable will be declared within the scope and not accessible anywhere else.