<html>
<script type="text/javascript">
function do_stuff(node, hooks) {
// Loop through the hooks
for (i = 0; hook = hooks[i]; i++) {
// Find the relevant checkbox
id = 'chkHook-' + hook;
checkbox = document.getElementById(id);
// Set the checkbox status to the status of the clicked one
if (typeof checkbox.checkCount == 'undefined') {
checkbox.checkCount = 0;
}
checkbox.checkCount += node.checked ? 1 : -1;
checkbox.checked = checkbox.checkCount > 0;
}
}
</script>
<input type="checkbox" onclick="do_stuff(this, ['node_info', 'insert'])" /> foo
<input type="checkbox" onclick="do_stuff(this, ['insert', 'update'])" /> bar
<input type="checkbox" onclick="do_stuff(this, ['update', 'load'])" /> baz
<br /><br /><br />
<input type="checkbox" id="chkHook-node_info" /> node_info<br />
<input type="checkbox" id="chkHook-insert" /> insert<br />
<input type="checkbox" id="chkHook-update" /> update<br />
<input type="checkbox" id="chkHook-load" /> load
</html>