Hi
I have a page with checkboxes. As people select these, a running total is displayed in a little popup,
within an input form name="total" id="total" using
onclick="checkTotal()" adds that value to the total, using
Code:
function checkTotal() {
var total = document.selectboxForm.total;
var choice = document.selectboxForm['choice[]'];
var choice1 = document.selectboxForm['choice1'];
var choice2 = document.selectboxForm['choice2'];
var sum = 0;
for (i=0;i<choice.length;i++) {
if (choice[i].checked)
sum = sum + parseInt(choice[i].value);
}
for (i=0;i<choice1.length;i++) {
if (choice1[i].checked)
sum = sum + parseInt(choice1[i].value);
}
for (i=0;i<choice2.length;i++) {
if (choice2[i].checked)
sum = sum + parseInt(choice2[i].value);
}
total.value = sum;
}
However, because I don't want them to see their final total till the next page, I was to suspend this totaliser afer about half the checkboxes.
What I would like to do is introduce a new function for the later checkboxes: onclick="checkReport()" which will overwrite the numerical total in the popup with words such as 'is shown on your report page'
I tried something like function checkReport() {
total.value = wordinghere;
}
but that doesn't work.
Any idea how to do this? (It's the value 'total' that needs to be overwritten, not 'finaltotal'. Is it possible to enter non-numerals in a value?
this is what a cutdown version of the checkboxes looks like:
http://ied.gospelcom.net/church-site-designtest1.php
Many thanks
Tony
Last edited by soon; 11-08-2007 at 07:38 PM..
Reason: clarity
|