View Single Post
Old 02-18-2007, 08:29 AM   #1 (permalink)
JMareel
Recruit
 
Join Date: Feb 2007
Posts: 20
JMareel is on a distinguished road
Question Select All Checkbox Code?!

Hello everyone. I am new to these forums and am also a newbie at coding.

After doing much research and scouring on the internet I have finally found the Selectall checkbox javascript code. I have been playing around with it to figure out what controls the script and define what checkboxes will be checked when the allbox checkbox is checked, but have not been able to figure it out. I need to modify the javascript code below to do a couple things.

1.) There are multiple tables each containing a title with checkbox and rows of choices with checkboxes next to each row. I would like to know how to modify the javascript so that if the user would like all the choices in Table1, they would click the checkbox next to Table1 title, thus checking all checkboxes in each row of Table1 only. Table2, Table3, etc. checkboxes would remain unchecked.

2.) Once all choices were checked in the order page and the SUBMIT button clicked, how would I show only the checked results in a separate confirmation page with the calculated price based on what choices were checked?

3.) In all my research on this topic I found out that spam spiders scour the internet looking at the source code and grab email addresses to collect. How can I beat these spam spiders and still have the results of the confirmation page sent to my email address? Or should I have the results saved as a file or other format for me to retrieve from my website?

Selectall Checkbox Code

Code:
<html>
<head>
<script language="javascript">
function checkAll(){
	for (var i=0;i<document.forms[0].elements.length;i++)
	{
		var e=document.forms[0].elements[i];
		if ((e.name != 'allbox') && (e.type=='checkbox'))
		{
			e.checked=document.forms[0].allbox.checked;
		}
	}
}
</script>
</head>

<body>
<form>
<input type="checkbox" value="on" name="allbox" onclick="checkAll();"/> Check all<br />

<h3>Fruit</h3>
<input type="checkbox" value="on" name="apples" /> Apples<br/>
<input type="checkbox" value="on" name="oranges" /> Oranges<br/>
<input type="checkbox" value="on" name="bananas" /> Bananas<br/>

</form>
</body>
</html>
Thanks in Advance,
JM
JMareel is offline   Reply With Quote