how to select all the checkbox
Posted: Wed Nov 30, 2005 4:51 am
here is my php code:
i want to select all the checkbox by javascript. it work fine if i only use checkbox name as chk. but, i have to use these above code for the other purpose.
here is my javascript (that have error)
plz correct my javascript.
regards
Code: Select all
<?php
$id = 0;
while($result=mysql_fetch_assoc($query))
{
?>
<tr class=text align=center>
<td><input type=checkbox name="chk[<?php echo $id?>]" value=<?php echo ($result["ID"])?>></td>
</tr>
<?php
$id++;
}
}
}
}
?>here is my javascript (that have error)
Code: Select all
function selectall()
{
for (i = 0; i <frmweekly.chk.length; i++)
frmweekly.chk[i].checked=true;
}regards