Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit check boxes chosen

Status
Not open for further replies.

deddleston

Programmer
Oct 4, 2002
43
0
0
GB
I have 6 checkboxes, 2 sets of 3,

At the moment any 6 can be chosen, but i need to limit it so that only those from one set can be chosen at a time (so max 3). When one is chosen from the other set, i want the others to clear.

I have absolutly no idea how to do this.

Daz M$ arn't the only option!
 
<script>
function checkBox(inBox){
if(inBox.checked == false){
return false;
}
switch(inBox.name){
case &quot;b1&quot;:
case &quot;b2&quot;:
case &quot;b3&quot;:
document.myForm.b4.checked = false
document.myForm.b5.checked = false
document.myForm.b6.checked = false
break;
case &quot;b4&quot;:
case &quot;b5&quot;:
case &quot;b6&quot;:
document.myForm.b1.checked = false
document.myForm.b2.checked = false
document.myForm.b3.checked = false
break;
}
}
</script>
<form name=myForm>
<input type=checkbox name=b1 onClick=&quot;checkBox(this)&quot;>
<input type=checkbox name=b2 onClick=&quot;checkBox(this)&quot;>
<input type=checkbox name=b3 onClick=&quot;checkBox(this)&quot;>

<input type=checkbox name=b4 onClick=&quot;checkBox(this)&quot;>
<input type=checkbox name=b5 onClick=&quot;checkBox(this)&quot;>
<input type=checkbox name=b6 onClick=&quot;checkBox(this)&quot;>
</form>
-----------------------------------------------------------------
DIM bulb
SET bulb = NEW brain

mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top