View Full Version : Resolved Select all checkbox script working on one page but not another?

11-17-2010, 02:44 PM
Hi all,

I have a script that checks and unchecks all boxes depending on the current state of the box. I have used it on one page and it works perfectly fine... copied it over to a new page where I wanted to reuse and can't get it to work.

<script type="text/javascript">
function check_all(form, input_name, self){

var input = form.getElementsByTagName('input');
for(var i = 0; i < input.length; i++){
input[i].checked = self.checked;

<input type="checkbox" name="notimportant" onclick="check_all(document.form1, 'check', this)" value="test" /><b>All</b>

<input type="checkbox" name="check_list[]" value="<?php echo $row2['email'];?>">

<form name="form1" action="emailspecificcandidates.php" method="post">

As I say this script works perfectly on another page, and as far as i can see i have copied everything over correctly.

Can anyone spot anything wrong?

Many thanks,


EDIT: I think this may be broken because of the way I presenting it with php on my page... i copied a seperate entity of the script onto the page and it worked first time.

11-17-2010, 03:54 PM
This is now solved, it was due to where i was placing the opening form tag!