Results 1 to 2 of 2

Thread: disable other checkboxes if 3 checkboxes are checked

  1. #1
    Join Date
    Aug 2009
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default disable other checkboxes if 3 checkboxes are checked

    hello

    im newbie here im not good in javascript but i need this code
    i want a function check if 3 checkboxes are checked
    and if they checked then it's will disable other checkboxes!

    as i say im not good in javascript.. this is my try:
    Code:
    function check_disable(box) {
    	
    	var index = 0;
    	
    	for(var i=0;i<box.form.elements.length;i++)
    	{
    		if(box.form.elements[i].checked == true)
    		{index = index + 1;}
    		else if(box.form.elements[i].checked == false)
    		{index = index - 1;}
    	}
    	
    	if(index >= 3)
    	{
    		for(i=0;i<box.form.elements.length;i++)
    		{
    				box.form.elements[i].disabled = !box.checked;
    		}
    	}
    }
    -->
    </script>
    i put onclick="check_disable(this);" in each checkbox
    this not work

    any help please
    thanks
    Last edited by al3bed; 08-28-2009 at 04:41 PM.

  2. #2
    Join Date
    Aug 2009
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    i found the answer

    solved

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •