I
ID10Terror
Hi:
I have 1 set (d1) of checkboxes, plus a total box that I will eventually
make "hidden". I now need 5 more sets of these.
I have tried copy and paste of everything within <form> and renaming it to
d2..d6 including the box names box1...box5 and
total0 to toal1..total5. I then copy and pasted the scripts 5 times
renaming all the box names, list names, etc and it does not
work. I got this code here at frontpage.programming awhile ago and I am
unable to modify it for my needs.
I need 6 separate checkbox sets and totals so that when I send the data via
cgi to my email, it gives me the total of the individual sets,
making later processing within outlook and access a snap.
Can anyone help with this problems please.
TIA
*********************************************************************************************
<html lang="en">
<head>
<title>46944</title>
<script type="text/javascript">
var txt = window.navigator.appName;
var ie = (txt == "Microsoft Internet Explorer") ? true : false;
var opera = (txt == "Opera") ? true : false;
</script>
</head>
<body>
<form>
<fieldset style="width: 243; height: 200">
<dl>
<dt><label for="1">1</label></dt>
<dd><input id="1" name="box0" type="checkbox" value="1"></dd>
<dt><label for="2">2</label></dt>
<dd><input id="2" name="box0" type="checkbox" value="2"></dd>
<dt><label for="4">4</label></dt>
<dd><input id="4" name="box0" type="checkbox" value="4"></dd>
<dt><label for="8">8</label></dt>
<dd><input id="8" name="box0" type="checkbox" value="8"></dd>
</dl>
<input id="total0" type="text" value="0">
</fieldset>
</form>
</body>
<script type="text/javascript">
var list = null;
if(ie)
{
list =
document.getElementsByTagName("dl")[0].getElementsByTagName("input");
}
else
{
list = document.getElementsByName("box0");
}
var i = 0;
for(i = 0; i < list.length; i++)
{
if(ie || opera)
{
list.onclick = create_total0;
}
else
{
list.addEventListener("click",create_total0,true);
}
}
var total0 = 0;
function create_total0()
{
total0 = 0;
for(i = 0; i < list.length; i++)
{
if(list.checked)
{
total0 += Number(list.value);
}
}
document.getElementById("total0").value = total0;
}
</script>
</html>
I have 1 set (d1) of checkboxes, plus a total box that I will eventually
make "hidden". I now need 5 more sets of these.
I have tried copy and paste of everything within <form> and renaming it to
d2..d6 including the box names box1...box5 and
total0 to toal1..total5. I then copy and pasted the scripts 5 times
renaming all the box names, list names, etc and it does not
work. I got this code here at frontpage.programming awhile ago and I am
unable to modify it for my needs.
I need 6 separate checkbox sets and totals so that when I send the data via
cgi to my email, it gives me the total of the individual sets,
making later processing within outlook and access a snap.
Can anyone help with this problems please.
TIA
*********************************************************************************************
<html lang="en">
<head>
<title>46944</title>
<script type="text/javascript">
var txt = window.navigator.appName;
var ie = (txt == "Microsoft Internet Explorer") ? true : false;
var opera = (txt == "Opera") ? true : false;
</script>
</head>
<body>
<form>
<fieldset style="width: 243; height: 200">
<dl>
<dt><label for="1">1</label></dt>
<dd><input id="1" name="box0" type="checkbox" value="1"></dd>
<dt><label for="2">2</label></dt>
<dd><input id="2" name="box0" type="checkbox" value="2"></dd>
<dt><label for="4">4</label></dt>
<dd><input id="4" name="box0" type="checkbox" value="4"></dd>
<dt><label for="8">8</label></dt>
<dd><input id="8" name="box0" type="checkbox" value="8"></dd>
</dl>
<input id="total0" type="text" value="0">
</fieldset>
</form>
</body>
<script type="text/javascript">
var list = null;
if(ie)
{
list =
document.getElementsByTagName("dl")[0].getElementsByTagName("input");
}
else
{
list = document.getElementsByName("box0");
}
var i = 0;
for(i = 0; i < list.length; i++)
{
if(ie || opera)
{
list.onclick = create_total0;
}
else
{
list.addEventListener("click",create_total0,true);
}
}
var total0 = 0;
function create_total0()
{
total0 = 0;
for(i = 0; i < list.length; i++)
{
if(list.checked)
{
total0 += Number(list.value);
}
}
document.getElementById("total0").value = total0;
}
</script>
</html>