Full version: jsB@nk » Form » Checkbox » Select One
URL: https://www.javascriptbank.com/select-one.html
Limits the number of checkboxes a user may click by deselecting the others upon selection. Cool!
Full version: jsB@nk » Form » Checkbox » Select One
URL: https://www.javascriptbank.com/select-one.html
<SCRIPT LANGUAGE="JavaScript">// Mike Best ([email protected])<!-- Beginfunction checkBoxValidate(cb) {for (j = 0; j < 8; j++) {if (eval("document.myform.ckbox[" + j + "].checked") == true) {document.myform.ckbox[j].checked = false;if (j == cb) {document.myform.ckbox[j].checked = true; } } }}// End --></script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<form name=myform>Selection 1<input type="checkbox" name="ckbox" onClick="javascript:checkBoxValidate(0)"><br>Selection 2<input type="checkbox" name="ckbox" onClick="javascript:checkBoxValidate(1)"><br>Selection 3<input type="checkbox" name="ckbox" onClick="javascript:checkBoxValidate(2)"><br>Selection 4<input type="checkbox" name="ckbox" onClick="javascript:checkBoxValidate(3)"><br>Selection 5<input type="checkbox" name="ckbox" onClick="javascript:checkBoxValidate(4)"><br>Selection 6<input type="checkbox" name="ckbox" onClick="javascript:checkBoxValidate(5)"><br>Selection 7<input type="checkbox" name="ckbox" onClick="javascript:checkBoxValidate(6)"><br>Selection 8<input type="checkbox" name="ckbox" onClick="javascript:checkBoxValidate(7)"><br></form><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->