<div id="block">
<input type="checkbox" name="ck[]" class="test" value="1">1
<input type="checkbox" name="ck[]" class="tovary" value="2">2
<input type="checkbox" name="ck[]" class="test" value="3">3
<input type="checkbox" name="ck[]" class="tovary" value="3">3</div>
<script>
block.onclick = function (e) {
var el = e ? e.target : window.event.srcElement;
if (el.tagName != "INPUT") return;
var inps = this.getElementsByTagName('input'),
len = inps.length,
len1 = len,
check = false,
inp;
for (; len--;) {
if (inps[len].checked) {
check = true;
break;
}
}
for (; len1--;) {
inp = inps[len1];
inp.disabled = check && inp.className != el.className;
}
};
</script>