Javascript 在树视图中选择父节点时,如何选择所有子节点?(当从usercontrol使用treeview时)

Javascript 在树视图中选择父节点时,如何选择所有子节点?(当从usercontrol使用treeview时),javascript,jquery,asp.net,.net,vb.net,Javascript,Jquery,Asp.net,.net,Vb.net,我有一个usercontrol,它只有Treeview控件 <asp:TreeView ID="Tree_Index" Style="font-size: 11px; font-family: Tahoma; font-weight: bold; text-align: left;" runat="server" Width="10px" EnableClientScript="False" ShowCheckBoxes="All" ShowLines="True"> </

我有一个usercontrol,它只有Treeview控件

<asp:TreeView ID="Tree_Index" 
Style="font-size: 11px; font-family: Tahoma; font-weight: bold; text-align: left;" runat="server" Width="10px" 
EnableClientScript="False" ShowCheckBoxes="All" ShowLines="True">
</asp:TreeView>
假设我的aspx页面上有6个TreeView。选择父节点时,我希望选择父节点的所有子节点。树视图将有三个级别的节点。因此,应该为该特定树选择父节点内的所有节点

我如何实现这一点,因为ID是由我在aspx页面中设置的。如何使用javascript、jquery或用户控件的代码隐藏来实现这一点

呈现的HTML:

<div id="ctl00_cphMain_pnl_left">



     <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("div[id $= Tree_Index] input[type=checkbox]").click(function () {
                $(this).closest("table").next("div").find("input[type=checkbox]").attr("checked", this.checked);
            });
        });
    </script>


<a href="#ctl00_cphMain_ctl03_Tree_Index_SkipLink"><img width="0" height="0" style="border-width:0px;" src="/WebResource.axd?d=vp_dPIRRqCpyFrxPBwqvPmsO-wa56CpxZGlT_T-AdX5QN0qJOs_wgfq4QMJwRILSj9XSONYmkJAe85CVEph0Q1SfUqs1&amp;t=634604712479085897" alt="Skip Navigation Links."></a><div style="width:10px;font-size: 11px; font-family: Tahoma; font-weight: bold; text-align: left;" onclick="OnTreeClick(event)" id="ctl00_cphMain_ctl03_Tree_Index">
        <table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><a href="javascript:__doPostBack('ctl00$cphMain$ctl03$Tree_Index','t1730b784-94ca-42d3-80aa-1c9c064e271c')"><img style="border-width:0;" alt="Collapse Clinics" src="/WebResource.axd?d=_533LbcrYzxclETTqT9E9lbjpoP9iiSVLn9WP908dD96sH9D2JXH4BN8Q2OdATM4TYJU67kfDSnJQpffp_ITMVu3Y839pir-IzEhB41mqu6U8EWb0&amp;t=634604712479085897"></a></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl03_Tree_Indexn0CheckBox" name="ctl00_cphMain_ctl03_Tree_Indexn0CheckBox"><a id="ctl00_cphMain_ctl03_Tree_Indext0" href="javascript:__doPostBack('ctl00$cphMain$ctl03$Tree_Index','s1730b784-94ca-42d3-80aa-1c9c064e271c')" class="ctl00_cphMain_ctl03_Tree_Index_0">Clinics</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl03_Tree_Indexn1CheckBox" name="ctl00_cphMain_ctl03_Tree_Indexn1CheckBox"><a id="ctl00_cphMain_ctl03_Tree_Indext1" href="javascript:__doPostBack('ctl00$cphMain$ctl03$Tree_Index','s1730b784-94ca-42d3-80aa-1c9c064e271c\\8086a7e5-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl03_Tree_Index_0">Respite Care Services</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl03_Tree_Indexn2CheckBox" name="ctl00_cphMain_ctl03_Tree_Indexn2CheckBox"><a id="ctl00_cphMain_ctl03_Tree_Indext2" href="javascript:__doPostBack('ctl00$cphMain$ctl03$Tree_Index','s1730b784-94ca-42d3-80aa-1c9c064e271c\\5586a7e5-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl03_Tree_Index_0">Caregiver Training</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl03_Tree_Indexn3CheckBox" name="ctl00_cphMain_ctl03_Tree_Indexn3CheckBox"><a id="ctl00_cphMain_ctl03_Tree_Indext3" href="javascript:__doPostBack('ctl00$cphMain$ctl03$Tree_Index','s1730b784-94ca-42d3-80aa-1c9c064e271c\\643eafdf-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl03_Tree_Index_0">Psychiatric Rehabilitation Homes</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl03_Tree_Indexn4CheckBox" name="ctl00_cphMain_ctl03_Tree_Indexn4CheckBox"><a id="ctl00_cphMain_ctl03_Tree_Indext4" href="javascript:__doPostBack('ctl00$cphMain$ctl03$Tree_Index','s1730b784-94ca-42d3-80aa-1c9c064e271c\\613dafdf-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl03_Tree_Index_0">Befriending Service</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl03_Tree_Indexn5CheckBox" name="ctl00_cphMain_ctl03_Tree_Indexn5CheckBox"><a id="ctl00_cphMain_ctl03_Tree_Indext5" href="javascript:__doPostBack('ctl00$cphMain$ctl03$Tree_Index','s1730b784-94ca-42d3-80aa-1c9c064e271c\\6fe899f7-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl03_Tree_Index_0">Polyclinics</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl03_Tree_Indexn6CheckBox" name="ctl00_cphMain_ctl03_Tree_Indexn6CheckBox"><a id="ctl00_cphMain_ctl03_Tree_Indext6" href="javascript:__doPostBack('ctl00$cphMain$ctl03$Tree_Index','s1730b784-94ca-42d3-80aa-1c9c064e271c\\7393b4d9-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl03_Tree_Index_0">Caregiver Support Service</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=BOvsSO2B3BKMupOSRxbma89ER-i_r1FrqfnVsgVq_QiVog3IJUebdD29i4BVAo26-lbJh_BLXmsQGU_VArXhNt6ejiWJk87whzKer6ts-_kM9Vt90&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl03_Tree_Indexn7CheckBox" name="ctl00_cphMain_ctl03_Tree_Indexn7CheckBox"><a id="ctl00_cphMain_ctl03_Tree_Indext7" href="javascript:__doPostBack('ctl00$cphMain$ctl03$Tree_Index','s1730b784-94ca-42d3-80aa-1c9c064e271c\\7a93b4d9-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl03_Tree_Index_0">Helpline - Caregiver Helpline</a></td>
            </tr>
        </tbody></table>
    </div><a id="ctl00_cphMain_ctl03_Tree_Index_SkipLink"></a>
<br>



     <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("div[id $= Tree_Index] input[type=checkbox]").click(function () {
                $(this).closest("table").next("div").find("input[type=checkbox]").attr("checked", this.checked);
            });
        });
    </script>


<a href="#ctl00_cphMain_ctl04_Tree_Index_SkipLink"><img width="0" height="0" style="border-width:0px;" src="/WebResource.axd?d=vp_dPIRRqCpyFrxPBwqvPmsO-wa56CpxZGlT_T-AdX5QN0qJOs_wgfq4QMJwRILSj9XSONYmkJAe85CVEph0Q1SfUqs1&amp;t=634604712479085897" alt="Skip Navigation Links."></a><div style="width:10px;font-size: 11px; font-family: Tahoma; font-weight: bold; text-align: left;" onclick="OnTreeClick(event)" id="ctl00_cphMain_ctl04_Tree_Index">
        <table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><a href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','tace7ae2e-c160-4982-a90f-785fc5b7cca7')"><img style="border-width:0;" alt="Collapse Home Care" src="/WebResource.axd?d=_533LbcrYzxclETTqT9E9lbjpoP9iiSVLn9WP908dD96sH9D2JXH4BN8Q2OdATM4TYJU67kfDSnJQpffp_ITMVu3Y839pir-IzEhB41mqu6U8EWb0&amp;t=634604712479085897"></a></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn0CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn0CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext0" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7')" class="ctl00_cphMain_ctl04_Tree_Index_0">Home Care</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><a href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','tace7ae2e-c160-4982-a90f-785fc5b7cca7\\0f93b4d9-217e-e111-9ca9-005056ba0039')"><img style="border-width:0;" alt="Collapse Home Nursing" src="/WebResource.axd?d=PtoZaOE4OJ68kA17eB1Ru-nLDbZ-ilvB8z5abVJ8BfKZp0iKKZ8iPpsV8tJ5bLWmNAAyfP3gCpxQRyrUtuHqeJKGILYd8Nbb3deoYK17HD9ZYyeS0&amp;t=634604712479085897"></a></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn1CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn1CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext1" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\0f93b4d9-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Home Nursing</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><div style="width:20px;height:1px"><img alt="" src="/WebResource.axd?d=J9BSVEmYJ2R79DzKPp_KwudhxkmRYjt31taLGpqjHFuG3gyciimdNIz2hfef3rMTcgKKF9rZcFetwoS-fvXnw3uYWh88CZ98-dNXPYEoMwTaffwZ0&amp;t=634604712479085897"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn2CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn2CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext2" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\0f93b4d9-217e-e111-9ca9-005056ba0039\\00000000-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Third Level 1</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><div style="width:20px;height:1px"><img alt="" src="/WebResource.axd?d=J9BSVEmYJ2R79DzKPp_KwudhxkmRYjt31taLGpqjHFuG3gyciimdNIz2hfef3rMTcgKKF9rZcFetwoS-fvXnw3uYWh88CZ98-dNXPYEoMwTaffwZ0&amp;t=634604712479085897"></div></td><td><img alt="" src="/WebResource.axd?d=BOvsSO2B3BKMupOSRxbma89ER-i_r1FrqfnVsgVq_QiVog3IJUebdD29i4BVAo26-lbJh_BLXmsQGU_VArXhNt6ejiWJk87whzKer6ts-_kM9Vt90&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn3CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn3CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext3" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\0f93b4d9-217e-e111-9ca9-005056ba0039\\11111111-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Third Level 2</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn4CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn4CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext4" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\c13eafdf-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Private Nursing Homes</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn5CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn5CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext5" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\1493a4eb-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Personal Healthcare Assistant</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn6CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn6CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext6" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\f592b4d9-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Home Medical</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn7CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn7CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext7" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\2493b4d9-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Home Therapy - Physiotherapy</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn8CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn8CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext8" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\1a93b4d9-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Home Therapy - Occupational Therapy</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn9CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn9CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext9" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\083eafdf-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Social Day Care Services</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn10CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn10CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext10" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\e7ba9bfd-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Community VWO Clinics</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn11CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn11CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext11" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\b292b4d9-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Day Rehabilitation Services</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn12CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn12CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext12" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\2087a7e5-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Community Wellness Clubs</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=BOvsSO2B3BKMupOSRxbma89ER-i_r1FrqfnVsgVq_QiVog3IJUebdD29i4BVAo26-lbJh_BLXmsQGU_VArXhNt6ejiWJk87whzKer6ts-_kM9Vt90&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl04_Tree_Indexn13CheckBox" name="ctl00_cphMain_ctl04_Tree_Indexn13CheckBox"><a id="ctl00_cphMain_ctl04_Tree_Indext13" href="javascript:__doPostBack('ctl00$cphMain$ctl04$Tree_Index','sace7ae2e-c160-4982-a90f-785fc5b7cca7\\8f93b4d9-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl04_Tree_Index_0">Community Hospitals</a></td>
            </tr>
        </tbody></table>
    </div><a id="ctl00_cphMain_ctl04_Tree_Index_SkipLink"></a>
<br>



     <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("div[id $= Tree_Index] input[type=checkbox]").click(function () {
                $(this).closest("table").next("div").find("input[type=checkbox]").attr("checked", this.checked);
            });
        });
    </script>


<a href="#ctl00_cphMain_ctl05_Tree_Index_SkipLink"><img width="0" height="0" style="border-width:0px;" src="/WebResource.axd?d=vp_dPIRRqCpyFrxPBwqvPmsO-wa56CpxZGlT_T-AdX5QN0qJOs_wgfq4QMJwRILSj9XSONYmkJAe85CVEph0Q1SfUqs1&amp;t=634604712479085897" alt="Skip Navigation Links."></a><div style="width:10px;font-size: 11px; font-family: Tahoma; font-weight: bold; text-align: left;" onclick="OnTreeClick(event)" id="ctl00_cphMain_ctl05_Tree_Index">
        <table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><a href="javascript:__doPostBack('ctl00$cphMain$ctl05$Tree_Index','tfc052442-3b20-4cdc-8d20-9c8544ac1c6f')"><img style="border-width:0;" alt="Collapse Other Services" src="/WebResource.axd?d=_533LbcrYzxclETTqT9E9lbjpoP9iiSVLn9WP908dD96sH9D2JXH4BN8Q2OdATM4TYJU67kfDSnJQpffp_ITMVu3Y839pir-IzEhB41mqu6U8EWb0&amp;t=634604712479085897"></a></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl05_Tree_Indexn0CheckBox" name="ctl00_cphMain_ctl05_Tree_Indexn0CheckBox"><a id="ctl00_cphMain_ctl05_Tree_Indext0" href="javascript:__doPostBack('ctl00$cphMain$ctl05$Tree_Index','sfc052442-3b20-4cdc-8d20-9c8544ac1c6f')" class="ctl00_cphMain_ctl05_Tree_Index_0">Other Services</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl05_Tree_Indexn1CheckBox" name="ctl00_cphMain_ctl05_Tree_Indexn1CheckBox"><a id="ctl00_cphMain_ctl05_Tree_Indext1" href="javascript:__doPostBack('ctl00$cphMain$ctl05$Tree_Index','sfc052442-3b20-4cdc-8d20-9c8544ac1c6f\\45bb0a98-ec44-e211-beaf-005056ba0039')" class="ctl00_cphMain_ctl05_Tree_Index_0">Mobile Services</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl05_Tree_Indexn2CheckBox" name="ctl00_cphMain_ctl05_Tree_Indexn2CheckBox"><a id="ctl00_cphMain_ctl05_Tree_Indext2" href="javascript:__doPostBack('ctl00$cphMain$ctl05$Tree_Index','sfc052442-3b20-4cdc-8d20-9c8544ac1c6f\\9b3dafdf-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl05_Tree_Index_0">Hospice Day Care</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl05_Tree_Indexn3CheckBox" name="ctl00_cphMain_ctl05_Tree_Indexn3CheckBox"><a id="ctl00_cphMain_ctl05_Tree_Indext3" href="javascript:__doPostBack('ctl00$cphMain$ctl05$Tree_Index','sfc052442-3b20-4cdc-8d20-9c8544ac1c6f\\f83dafdf-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl05_Tree_Index_0">Website - Disability Information Website</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=Ptpr_s5NKQd2NhXQH_MiSClxDVR5ZHar9QZwFenhB3L_8-vIXRA_NHlxqP3iWPQWzSbDizVZ5YO8o3q4fX1XUhismQEMBdpf8AuHvaSyrvYco4WB0&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl05_Tree_Indexn4CheckBox" name="ctl00_cphMain_ctl05_Tree_Indexn4CheckBox"><a id="ctl00_cphMain_ctl05_Tree_Indext4" href="javascript:__doPostBack('ctl00$cphMain$ctl05$Tree_Index','sfc052442-3b20-4cdc-8d20-9c8544ac1c6f\\33333333-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl05_Tree_Index_0">Information &amp; Referral Services</a></td>
            </tr>
        </tbody></table><table cellspacing="0" cellpadding="0" style="border-width:0;">
            <tbody><tr>
                <td><div style="width:20px;height:1px"></div></td><td><img alt="" src="/WebResource.axd?d=BOvsSO2B3BKMupOSRxbma89ER-i_r1FrqfnVsgVq_QiVog3IJUebdD29i4BVAo26-lbJh_BLXmsQGU_VArXhNt6ejiWJk87whzKer6ts-_kM9Vt90&amp;t=634604712479085897"></td><td style="white-space:nowrap;"><input type="checkbox" id="ctl00_cphMain_ctl05_Tree_Indexn5CheckBox" name="ctl00_cphMain_ctl05_Tree_Indexn5CheckBox"><a id="ctl00_cphMain_ctl05_Tree_Indext5" href="javascript:__doPostBack('ctl00$cphMain$ctl05$Tree_Index','sfc052442-3b20-4cdc-8d20-9c8544ac1c6f\\44444444-217e-e111-9ca9-005056ba0039')" class="ctl00_cphMain_ctl05_Tree_Index_0">Ambulance Service (Non-Emergency)</a></td>
            </tr>
        </tbody></table>
    </div><a id="ctl00_cphMain_ctl05_Tree_Index_SkipLink"></a>
<br>


</div>

$(文档).ready(函数(){
$(“div[id$=Tree\u Index]input[type=checkbox])。单击(函数(){
$(this.closest(“table”).next(“div”).find(“input[type=checkbox]”).attr(“checked”,this.checked);
});
});


您只需使用此代码即可

$(document).ready(function() {
    $("div[id $= Tree_Index]").find("input[type=checkbox]:first").click(function() {
        $(this).closest("div").find(':checkbox').attr('checked', this.checked);
    });
});

您只需使用此代码即可

$(document).ready(function() {
    $("div[id $= Tree_Index]").find("input[type=checkbox]:first").click(function() {
        $(this).closest("div").find(':checkbox').attr('checked', this.checked);
    });
});

如果您想在jquery中找到解决方案,那么您应该发布呈现的HTML,而不是发布aspx页面的代码。无需发布vb.net的代码。@rahularyansharma我已经用呈现的HTML更新了问题。HTML将有3个树状视图控件。我已尝试将HTML放在JSFIDLE中。在这里,您可以将其更改为更好的外观,并在您的问题中发布其链接。@rahularyansharma在这个意义上看起来更好吗?我刚刚从浏览器中复制了呈现的HTML。谢谢。@rahularyansharma单击诊所(父节点)选择它的所有子节点。单击“家庭护理(父级)”时,选择其所有子节点。单击“其他服务”(父项)时,选择它的所有子节点。如果您希望在jquery中获得解决方案,则不应发布aspx页面的代码,而应发布呈现的HTML。无需发布vb.net的代码。@rahularyansharma我已经用呈现的HTML更新了问题。HTML将有3个树状视图控件。我已尝试将HTML放在JSFIDLE中。在这里,您可以将其更改为更好的外观,并在您的问题中发布其链接。@rahularyansharma在这个意义上看起来更好吗?我刚刚从浏览器中复制了呈现的HTML。谢谢。@rahularyansharma单击诊所(父节点)选择它的所有子节点。单击“家庭护理(父级)”时,选择其所有子节点。单击其他服务(父项)时,选择其所有子节点。