81
rated 0 times
[
83]
[
2]
/ answers: 1 / hits: 31679
/ 11 Years ago, fri, july 5, 2013, 12:00:00
<script type="text/javascript">
function checkAll(formname, checktoggle)
{
var checkboxes = new Array();
checkboxes = document[formname].getElementsByTagName('input');
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].type === 'checkbox') {
checkboxes[i].checked = checktoggle;
}
}
}
</script>
<form name="myform">
<li>
<label class="cba">
<a href="javascript:void();" onclick="javascript:checkAll('myform', true);">Check All</a> |
<a href="javascript:void();" onclick="javascript:checkAll('myform', false);">UnCheck All</a>
</label>
</li>
<li>
<input class="cba" type="checkbox" name="content1" value="1"<?php checked('1', $slct); ?>/>
</li>
<li>
<input class="cbc" type="checkbox" name="content2" value="2"<?php checked('2', $copy); ?>/>
</li>
<li>
<input class="cbx" type="checkbox" name="content3" value="3"<?php checked('3', $cut); ?>/>
</li>
</form>
I have made the toggle option for the checkbox check all and uncheck all. Still now check all and uncheck all is not working I get the error in console while viewing in Firebug. Here is the screenshot I attached.
I am not sure what was my mistake:
Any suggestion would be great.
More From » php