javascript, checkbox disable other choice with color

using javascript the setup is this:
i have various diffrent checkbox options in a 3 colum row
i want to disable all other options once the user choses one option.
the row should then turn greyish and all other choices are disabled(they open up again if the user pushes check again)
this should happen in a number of rows

any help would be greatly appreciated
codewizard2003Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JayhpotCommented:
since u hav chosen to use a checkbox, i assume that those checkboxes use different names...
lets say they are check1, check2 and check3...

you may choose to add the javascript in the onClick property of each checkbox or u can create a function that you will call in the onclick property...

either way... you will have the same codes...

set the disabled property of the unchosen checkboxes to false if the chosen checkbox is checked and vise versa...

hence:

<script language="javascript">

   function checkThis(a,b,c){
       //where a is the name of the clicked checkbox
       //and b,c are the names of the unclicked checkbox

       if(eval("document.form1." + a + ".checked==true")){
           eval("document.form1." + b + ".disabled=true")
           eval("document.form1." + c + ".disabled=true")
       }else{
           eval("document.form1." + b + ".disabled=false")
           eval("document.form1." + c + ".disabled=false")
       }
   }
</script>

<form name=form1 action=""...>
  <input type=checkbox name=check1 onClick="checkThis('check1','check2','check3');">...
  <input type=checkbox name=check2 onClick="checkThis('check2','check1','check3');">...
  <input type=checkbox name=check3 onClick="checkThis('check3','check1','check2');">...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
northernchillCommented:
The following code will work with any number of checkboxes contained within a form name CheckForm.

Your checkbox tag should read something like:
<INPUT id=checkbox7 type=checkbox name=checkbox7 onclick="return chBoxOnClick(this)">


<Script language="javascript">

var checkCount;
checkCount = 0;
function chBoxOnClick(obj) {

if(document.forms(0).item(obj.id).checked)
   checkCount++;
else
   checkCount--;

if(checkCount < 2)
   enabled = 0;
else
   enabled =1;
     
for(i=0;i<document.forms("CheckForm").length;i++)
{
   if(document.forms(0).item(i).type == "checkbox")
   {
      if(!document.forms(0).item(i).checked)
         document.forms(0).item(i).disabled = enabled;
   }
}
     
}
</script>
0
CleanupPingCommented:
codewizard2003:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
JayhpotCommented:
i recommend to accept the combination of my answer and that of northernchill's
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.