This solution uses a cb class selector on the "child" textboxes. Another solution would be to select all those that don't have an id=all. It compares the length of the set of checked child checkboxes with the length of the set of all child checkboxes to determine if all should be checked.
<script type="text/javascript">
$(document).ready(function() {
$('#all').click(function() {
$('.cb').attr('checked', this.checked);
});
$('.cb').click(function() {
var allChecked = $('.cb:checked').length == $('.cb').length;
$('#all').attr('checked', allChecked);
});
});
</script>
<input type="checkbox" name="checkGroup" id="all" value="0" />All
<input type="checkbox" name="checkGroup" id="one" class="cb" value="1" />One
<input type="checkbox" name="checkGroup" id="two" class="cb" value="2" />Two
<input type="checkbox" name="checkGroup" id="three" class="cb" value="3" />Three