Bruce Gust
asked on
How can I implement a "Select All" with this configuration...?
Here's my HTML:
<input type="checkbox" value="13" name="chkbox_13">
<input type="checkbox" value="14" name="chkbox_14">
<input type="checkbox" value="25" name="chkbox_25">
<input type="checkbox" value="43" name="chkbox_43">
It's at PHP script that's looping through all of the students in the database. Their ID is both the value and the latter portion of the "chkbox_
dynamic.
I want to incorporate a "Select All." I was drawn to this:
<script language="JavaScript">
function toggle(source) {
checkboxes = document.getElementsByName ('foo');
for each(var checkbox in checkboxes)
checkbox.checked = source.checked;
}
</script>
<input type="checkbox" onClick="toggle(this)" /> Toggle All<br/>
But in light of the way I'm naming my checkboxes, I figured I needed some help.
Thoughts?
<input type="checkbox" value="13" name="chkbox_13">
<input type="checkbox" value="14" name="chkbox_14">
<input type="checkbox" value="25" name="chkbox_25">
<input type="checkbox" value="43" name="chkbox_43">
It's at PHP script that's looping through all of the students in the database. Their ID is both the value and the latter portion of the "chkbox_
dynamic.
I want to incorporate a "Select All." I was drawn to this:
<script language="JavaScript">
function toggle(source) {
checkboxes = document.getElementsByName
for each(var checkbox in checkboxes)
checkbox.checked = source.checked;
}
</script>
<input type="checkbox" onClick="toggle(this)" /> Toggle All<br/>
But in light of the way I'm naming my checkboxes, I figured I needed some help.
Thoughts?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I changed my naming conventions and learned a little bit about how to name an input field in a way the system understands to be an array.
Sweet!
Thanks!
Sweet!
Thanks!
ASKER