TerryMan
11-03-2006, 03:54 PM
I am trying to count certain checkboxs on a form to obtain a total. I have tried the standard script by Alan Gruskoff that I tried to modify and I am getting the following error Object required
Here is the script
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Alan Gruskoff (alan@performantsystems.com) -->
<!-- Web Site: http://www.performantsystems.com/ -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function anyCheck(form) {
var total = 0;
var max = form.platlist.Table3.no.length;
for (var idx = 0; idx < max; idx++) {
if (eval("document.platlist.Table3.no[" + idx + "].checked") == true) {
total += 1;
}
}
alert("You selected " + total + " boxes.");
}
// End -->
</script>
Here is the button
<p><input type=button value="Count Checkboxes" onClick="anyCheck(this.form)">
The input form is a table
<form name="platlist" action="" method="POST">
<!-- -->
<!-- [END PRE-Table3] -->
<table id="Table3" border="1" cellspacing="2" cellpadding="2" width="100%" style="border-left-color: rgb(128,128,128); border-top-color: rgb(128,128,128); border-right-color: rgb(128,128,128); border-bottom-color: rgb(128,128,128); height: 773;" NOFINSIDE="~! ~!" >
<tr style="height:19px"> .......
[B]I have 64 check boxes on the form and I want to total up the the ones with the name = no that are checked below is the html for the one of the check boxs.
<input id="FormsCheckbox70" type="checkbox" name="no" value="" NO FINSIDE="~! ~!" onClick="return(F_e('FormsCheckbox70', F_CL))">
<!-- [BEGIN POST-FormsCheckbox70] -->
When I press the button I get object required as a error code 0
Thanks in advance
Terry
Here is the script
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Alan Gruskoff (alan@performantsystems.com) -->
<!-- Web Site: http://www.performantsystems.com/ -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function anyCheck(form) {
var total = 0;
var max = form.platlist.Table3.no.length;
for (var idx = 0; idx < max; idx++) {
if (eval("document.platlist.Table3.no[" + idx + "].checked") == true) {
total += 1;
}
}
alert("You selected " + total + " boxes.");
}
// End -->
</script>
Here is the button
<p><input type=button value="Count Checkboxes" onClick="anyCheck(this.form)">
The input form is a table
<form name="platlist" action="" method="POST">
<!-- -->
<!-- [END PRE-Table3] -->
<table id="Table3" border="1" cellspacing="2" cellpadding="2" width="100%" style="border-left-color: rgb(128,128,128); border-top-color: rgb(128,128,128); border-right-color: rgb(128,128,128); border-bottom-color: rgb(128,128,128); height: 773;" NOFINSIDE="~! ~!" >
<tr style="height:19px"> .......
[B]I have 64 check boxes on the form and I want to total up the the ones with the name = no that are checked below is the html for the one of the check boxs.
<input id="FormsCheckbox70" type="checkbox" name="no" value="" NO FINSIDE="~! ~!" onClick="return(F_e('FormsCheckbox70', F_CL))">
<!-- [BEGIN POST-FormsCheckbox70] -->
When I press the button I get object required as a error code 0
Thanks in advance
Terry