ashishrathore Posted January 20, 2006 Share Posted January 20, 2006 hi,i am having prob regarding checking all/none checkboxeshere is a snapshot of that page that i want to refer Select Category : cat1 subcat11 subcat12 cat2 subcat21 subcat22 subcat23 cat3 subcat31 subcat323 cat5 subcat51 subcat52 subcat53 subcat54 cat9 subcat91 subcat92 all the cat are main categories and in front of that there are corrosponding subcategories subcatwhat i want is when i select a cat then all the corrosponding subcat must be selected mind u the problem is that all these categories and the subcategories are dynamically taken from a text file so it is not fixed for a certain number of lines.i had created the function using JS for this but when i select any cat all the subcat of all the categories are selected, so i want only the corrosponding subcat to be selected and not the all subcat.here is my JS functionfunction checkAll(checkname, exby) { for (i = 0; i < checkname.length; i++) checkname.checked = exby.checked? true:false } //////// but it check all the subcategories and not the corrosponding subcat.the code 4 checkboxes is smthng like this.....<input type=checkbox name="main[]" value="<?php echo "$mainh"; ?>" onClick="checkAll(document.pform.sub,this)"> ///this is the main category part <input type=checkbox name="sub" value="<?php echo "$subname"; ?>"><?php echo "$sub"; ?> /////this is 4 generating subcategories.plz help me.... -ashish Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now