copy total to textbox then reset form except for copied total
hello
i have several checkboxes that hold a value. when the checkbox is checked a running total is kept.
when user is done, they click one of 4 buttons. the textbox above the button should now have the total in it.
the user would then hit reset & the form would reset EXCEPT for any of the textboxes that are storing the user saved totals.
i have tried several diff ways with diff codes i have found but nothing will make it copy over & keep it there as hitting reset clears the whole form.
Code:
<script type="text/javascript">
<!--
onload = function () {
var e, i = 0;
while (e = document.myform.elements[i++]) {
if (e.type == 'checkbox') e.onclick = function () {
var e, i = 0, total = 0;
while (e = document.myform.elements[i++]) {
if (e.type == 'checkbox' && e.checked) total += Number (e.value) || 0;
document.myform.elements.total.value = total;
}
}
}
}
// -->
</script>
<script type="text/javascript">
function copyOne(cbox)
{
if(document.getElementById('bone').clicked == true) {
document.getElementById("one").value = document.getElementById("total").value;
}
}</script>
HTML Code:
<body>
<form name="myform" action="checkboxes.asp" method="post">
<fieldset>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="68%" height="135">
<tr>
<td width="11%" align="center" height="43"></td>
<td width="11%" align="center" height="43"></td>
<td width="11%" align="center" height="43"></td>
<td width="11%" align="center" height="43">
</td>
<td width="11%" align="center" height="43"></td>
<td width="11%" align="center" height="43"></td>
<td width="11%" align="center" height="43"></td>
</tr>
<tr>
<td width="11%" align="center" height="23">
<input type="text" name="one" id="one" size="3" readonly="readonly">
</td>
<td width="11%" align="center" height="23">
<input type="text" name="two" id="two" size="3" readonly="readonly">
</td>
<td width="11%" align="center" height="23"></td>
<td width="11%" align="center" height="23"><label>Total: <input type="text" name="total" id="total" class="num" size="3" value="0" readonly="readonly" /></label>
</td>
<td width="11%" align="center" height="23"></td>
<td width="11%" align="center" height="23">
<input type="text" name="three" id="three" size="3" readonly="readonly">
</td>
<td width="11%" align="center" height="23">
<input type="text" name="four" id="four" size="3" readonly="readonly">
</td>
</tr>
<tr>
<td width="11%" align="center" height="21"><input type="button" value="ONE" name="one" id="bone"></td>
<td width="11%" align="center" height="21"><input type="button" value="TWO" name="two" id="btwo"></td>
<td width="11%" align="center" height="21"></td>
<td width="11%" align="center" height="21"></td>
<td width="11%" align="center" height="21"></td>
<td width="11%" align="center" height="21"><input type="button" value="THREE" name="three" id="bthree"></td>
<td width="11%" align="center" height="21"><input type="button" value="FOUR" name="four" id="bfour"></td>
</tr>
<tr>
<td width="11%" align="center" height="27">
</td>
<td width="11%" align="center" height="27">
</td>
<td width="11%" align="center" height="27"></td>
<td width="11%" align="center" height="27">
<input type="reset" value="Reset" name="reset">
</td>
<td width="11%" align="center" height="27"></td>
<td width="11%" align="center" height="27">
</td>
<td width="11%" align="center" height="27">
</td>
</tr>
<tr>
<td width="11%" align="center" height="21"></td>
<td width="11%" align="center" height="21"></td>
<td width="11%" align="center" height="21"></td>
<td width="11%" align="center" height="21"></td>
<td width="11%" align="center" height="21"></td>
<td width="11%" align="center" height="21"></td>
<td width="12%" align="center" height="21"></td>
</tr>
</table>
</center>
</div>
<hr color="#000000">
<div id="placement">
<div align="center">
<center>
<table border="0" width="59%" height="399" cellspacing="1">
<tr>
<td width="5%" align="center" height="32"><label><input type="checkbox" name="check_list" value="41" />41</label> </td>
<td width="5%" align="center" height="32"><label><input type="checkbox" name="check_list" value="42" />42</label> </td>
<td width="5%" align="center" height="32"><label>43<input type="checkbox" name="check_list" value="43" /></label></td>
</tr>
<tr>
<td width="5%" align="center" height="32"><label><input type="checkbox" name="check_list" value="40" />40</label> </td>
<td width="5%" align="center" height="32"></td>
<td width="5%" align="center" height="32"><label>44<input type="checkbox" name="check_list" value="44" /></label></td>
</tr>
<tr>
<td width="5%" align="center" height="32"><label><input type="checkbox" name="check_list" value="39" />39</label>
</td>
<td width="5%" align="center" height="32"></td>
<td width="5%" align="center" height="32"><label>45<input type="checkbox" name="check_list" value="45" /></label></td>
</tr>
<tr>
<td width="5%" align="center" height="32"><label><input type="checkbox" name="check_list" value="38" />38</label>
</td>
<td width="5%" align="center" height="32"></td>
<td width="5%" align="center" height="32"><label>46<input type="checkbox" name="check_list" value="46" /></label></td>
</tr>
</table>
</center>
</div>
</fieldset>
</form>
</body>
any help would be greatly appreciated & thanks in advance for your time.
HippieChickie