Use js to determine whether the check box is selected and the number of selected check boxes. In the past, friends often mentioned the selection of check boxes. This code can help you solve this problem, and it can also determine how many check boxes you have selected. If multiple selections are available, a prompt will pop up.
<HTML><head><title>Judge whether the check box is selected and the number of selected</title><SCRIPT LANGUAGE="JavaScript">function countChoices(obj) {max = 2;box1 = obj.form.box1.checked;box2 = obj.form.box2.checked;box3 = obj.form.box3.checked;count = (box1 ? 1 : 0) + (box2 ? 1 : 0) + (box3 ? 1 : 0);if (count > max) {alert("Sorry, you can only select" + max + "Two!");obj.checked = false; }}//--></script><body> <form name="form"> The language you like is (up to two): <p><input type=checkbox name=box1 onClick="countChoices(this)">ASP.NET<p> <input type=checkbox name=box2 onClick="countChoices(this)">JAVA<p> <input type=checkbox name=box3 onClick="countChoices(this)">C#<p> </form></body></html>The above js article determines whether the check box is selected and the number of selected implementation code is all the content I have shared with you. I hope it can give you a reference and I hope you can support Wulin.com more.