...

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



greens85
11-17-2010, 01: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){
if(!input_name){
return;
}

var input = form.getElementsByTagName('input');
for(var i = 0; i < input.length; i++){
if(input[i].name.indexOf(input_name)!=-1){
input[i].checked = self.checked;
}
}
}
</script>


<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,

Greens85

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.

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum