In velocità ho sistemato il tuo codice: c'erano un po' di errori, e ti consiglio in ogni caso di mettere sempre il punto e virgola alla fine di ogni istruzione.
L'ho provato con Firefox e IE8.
codice:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Max 3 checkbox selezionate</title> <script type="text/javascript"> function checkCount() { var checkGroup = []; var limit = 3; for (var f=0; f<6; f++){ checkGroup.push(document.getElementById('vetrina'+f)); for (var i=0; i<checkGroup.length; i++){ checkGroup[i].onclick = function() { var checkedCount = 0; for (var j=0; j<checkGroup.length; j++) { checkedCount += (checkGroup[j].checked)? 1 : 0; if (checkedCount>limit) { alert("Hai superato il limite di " + limit + " checkbox selezionate.") this.checked = false; break; } } } } } } </script> </head> <body onload="checkCount()"> <form action="" method="post"> <input type="checkbox" class="checkbox" value="1" name="vetrina[]" id="vetrina0" /><label for="vetrina0">Vetrina 0</label> <input type="checkbox" class="checkbox" value="2" name="vetrina[]" id="vetrina1" /><label for="vetrina1">Vetrina 1</label> <input type="checkbox" class="checkbox" value="3" name="vetrina[]" id="vetrina2" /><label for="vetrina2">Vetrina 2</label> <input type="checkbox" class="checkbox" value="4" name="vetrina[]" id="vetrina3" /><label for="vetrina3">Vetrina 3</label> <input type="checkbox" class="checkbox" value="5" name="vetrina[]" id="vetrina4" /><label for="vetrina4">Vetrina 4</label> <input type="checkbox" class="checkbox" value="6" name="vetrina[]" id="vetrina5" /><label for="vetrina5">Vetrina 5</label> <input type="submit" value="Invia" /> </form> </body> </html>

Rispondi quotando