select the group of check box javascript
<p>in the website i am developing i am adding the list of menus and sub menus in the database. for creating a category to user the menus in website i have form to create a category in the their will the list of main menu and sub menus with a check box which comes dynamically from database. the thing is if i select the main menu check box the sub menu check box should be selected like a parent child format. bu getting the check box from the menu and check box dynamically i am feeling difficulty in this.</p>

<pre><code>&lt;?php
if ($arrAllMainMenuDetail) {
    $mmNo++;
    foreach ($arrAllMainMenuDetail as $mainmenuList) {
        $arrAllSubMenuDetail = $objMenu-&gt;getAllSubMenuDetails(false, 0, $mainmenuList['mainmenuId']); ?&gt;
        &lt;input type="checkbox" name="mainmenu[]" id="mainmenu&lt;? echo $mmNo; ?&gt;" value="&lt;? $mainmenuList['mainmenuid']?&gt;"
            onClick="Check(document.menuForm.mainmenu&lt;? echo $mmNo; ?&gt;.value)"/&gt; &lt;? echo $mainmenuList['mainmenuName']; ?&gt;
        &lt;br/&gt;
        &lt;?php
        if ($arrAllSubMenuDetail) {
            $smNo = 0;
            foreach ($arrAllSubMenuDetail as $submenuList) { ?&gt;
                &lt;input type="checkbox" name="submenu[]" id="submenu&lt;? echo $smNo; ?&gt;" value="&lt;? $submenuList['submenuId']?&gt;"
                    style="margin-left:15px;"/&gt; &lt;? echo $submenuList['submenuName']; ?&gt;
                &lt;br/&gt;
                &lt;?php $smNo++;
            }
        }
        $mmNo++;
    }
}
?&gt;
</code></pre>
