Heute, als ich an einem Projekt gearbeitet habe, habe ich auf ein Problem gestoßen. Ich musste mehrere Kontrollkästchen mehrerer Kontrollkästchen für das Kontrollkästchen angeben, durfte jedoch nur bis zu 6 auswählen. Nachdem er lange Debuggs debuggen, ist er schließlich herausgekommen, der Code lautet wie folgt:
<Script Language = "javaScript"> var c = 0, limit = 6; Funktion DECHECK (OBJ) {Obj.Checked? C ++: C-; if (c> limit) {obj.checked = false; alarm ("über"); C--; }} </Script> <html> <body> <Eingabe type = "checkbox" name = "sample1" onclick = "ddeck (this)"> a <Eingabe type = "Checkbox" name = "sample2" Onclick = "DOCheck (this)"> b <eingabetyp = "Checkbox" name "sample" sample "sample" sample "sample" sample = "docheck (thisCheck (thisCheck" (thisCheck (thisCheck) (thisCheck (thisChECh) " onClick="doCheck(this)">D <input type="CHECKBOX" name="sample5" onClick="doCheck(this)">E <input type="CHECKBOX" name="sample6" onClick="doCheck(this)">F <input type="CHECKBOX" name="sample7" onClick="doCheck(this)">G <input type="CHECKBOX" name="sample8" Onclick = "Dokeck (this)"> h <Eingabe type = "postbox" name = "sample9" onclick = "ddecksed (this)"> i <Eingabe type = "CheckBox" name = "sample10" Onclick = "Dokeck (this)"> J </body> </html>>Die Anzeigeergebnisse sind wie folgt: