View Single Post
Old 02-18-2007, 06:37 PM   #6 (permalink)
JMareel
Recruit
 
Join Date: Feb 2007
Posts: 20
JMareel is on a distinguished road
OK what am I doing wrong?

This is the code I have between head.
Code:
<head>
<script language="javascript">
function checkAll(table){
	for (var i=0;i<document.forms[0].elements.length;i++)
	{
		var e=document.forms[0].elements[i];
		if ((e.name.substring(0,table.length) == table) && (e.name != 'allbox') && (e.type=='checkbox'))
		{
			e.checked=document.forms[0].allbox.checked;
		}
	}
}
</script>
This is the code I have for the allbox
Code:
<input type="checkbox" value="on" name="allbox" onclick="checkAll("table1");"/>
And this is the code for the regular checkbox(es)
Code:
<input type="checkbox" name="table2_Bacteria" value="Bacteria"></td>
Where exactly do I put the function code. Maybe I am placing the javascript function code in the wrong place. Could you please give specific instructions as I fear my assumptions are the problem.

Thanks,
JM
JMareel is offline   Reply With Quote