Я специально сделал минимум, чтобы удобней читать
<script type="text/javascript">
function checkAllOne(formName, checkboxName, varChecked) {
var tablinks = document.getElementById('one').getElementsByTagName('input');
for (var i = 0, j = tablinks.length; i < j; i++) {
formName[checkboxName][i].checked = varChecked;
}
}
function checkAllTwo(formName, checkboxName, varChecked) {
var tablinks = document.getElementById('one').getElementsByTagName('input');
for (var i = 0, j = tablinks.length; i < j; i++) {
formName[checkboxName][i].checked = varChecked;
}
}
</script>
<input type="checkbox" name="total" onClick="checkAllOne(this.form,'phone[]',this.checked)" />Выбрать все
<div id='one'>
<input type='checkbox' name='phone[]' />
<input type='checkbox' name='phone[]' />
<input type='checkbox' name='phone[]' />
</div>
<input type="checkbox" name="total" onClick="checkAllTwo(this.form,'phone[]',this.checked)" />Выбрать все
<div id='two'>
<input type='checkbox' name='phone[]' />
<input type='checkbox' name='phone[]' />
<input type='checkbox' name='phone[]' />
</div>