Javascript Code for Check/Uncheck all Checkboxes

Sravya
Posted by Sravya under JavaScript category on | Points: 40 | Views : 1632
<script language="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>

Comments or Responses

Posted by: T.Saravanan on: 11/15/2012 Level:Silver | Status: [Member] [MVP] | Points: 10
Please modify your code with other variable instead of 'i' and also post your code inside the code tag.

Login to post response