check/uncheck all check boxes
I have the code for select and de-select all check boxes at the same time. It worked fine for all check boxes inside the cfloop but the other check box outside the cfloop is harzard is also messup. Right now, when i click on the check box for Select / Deselect All check box, the check box for for harzard is also check/uncheck and I don't want it to be checked but don't know how, can you help?.
<script language="javascript" >
checked=false;
function checkedAll (frm) {
var aa= document.getElementById('frm');
if (checked == false)
{
checked = true
}
else
{
checked = false
}
for (var i =0; i < aa.elements.length; i++)
{
aa.elements.checked = checked;
}
}
</script>
<cfform action="insert.cfm" name="frm" id="frm" method="post">
<input type='checkbox' name='checkall' onclick='checkedAll(frm);'> Select / Deselect All
<cfloop query="variables.qlist">
<cfinput type="checkbox" id="instanaceid" name="instanaceid" value="#id#">#shortname#
</cfloop>
<br>
<cfinput type="checkbox" name="hazard" id="hazard" value="1">
<cfinput type="submit" name="submit" id="submit" value="Save">
</cfform>
Thanks
KT
