Examples are as follows:
<SCRIPT LANGUAGE="JavaScript">//Judge the same type of function checkboxnum(){ var form = document.forms['formbj1']; var i,j=0; for (i=0; i<form.length; i++){ var e=form[i]; if (e.checked && e.type=='checkbox' && e.name=='bjid[]') { j++; if(j==3){alert("Can only select 2 items!");return false;break; } } }}</script><form action="zhdk_bj.php" method="post" name="formbj1" id="formbj1"><input name="bjid[]" id="bjid[]" type="checkbox" onclick="return checkboxnum()" value="1" /><input name="bjid[]" id="bjid[]" type="checkbox" onclick="return checkboxnum()" value="2" /><input name="bjid[]" id="bjid[]" type="checkbox" onclick="return checkboxnum()" value="3" /></form>The above method of judging whether checkbox is selected (super simple) is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.