Script Categories

Forms >>> Select One.

Limits the number of checkboxes a user may click by deselecting the others upon selection.

Selection 1
Selection 2
Selection 3
Selection 4
Selection 5
Selection 6
Selection 7
Selection 8

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function 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 -->
<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>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).