function conta(){
var sel=0;
var box = document.getElementsByTagName('input');
for(i=0; i<box.length; i++){
if(box[i].getAttribute("type") == 'checkbox' && box[i].checked){
sel++}
}
for(a=0; a<box.length; a++){
if(sel>4 && !box[a].checked && box[i].getAttribute("type") == 'checkbox'){
box[a].setAttribute("disabled","disabled");
}else{
box[a].removeAttribute("disabled");
}
}
}
Aggiungi la parte in rosso, credovo che un minimo di js ci fosse