TreeView 控件中带checkbox

$(document).ready(function() {

var widthvalue;

if (jQuery.browser.msie) {

$("#DropDownList1").focus(function() {

widthvalue = $(this).css("width");

$(this).css("width", "auto");

}).blur(function() {

$(this).css("width", widthvalue);

});

}

});

http://kb.cnblogs.com/a/773764/

<head runat="server">
    <title>无标题页</title>
    <script src="jquery-1.5.2.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            //为了不至于和页面上其他元素混乱,所以把TreeView控件放在一个id为Treeview的div中,然后
            //再查找checkbox
            $("#Treeview table tr td  input[type=checkbox]").live("click",
             function () {

                 $("#Treeview div[id=" + $(this).attr("id").toString().replace(/CheckBox/, "Nodes") + "] table tr td  input[type=checkbox]")
                    .attr("checked", $(this).attr("checked"));
                         }
            );
             });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div id ="Treeview" runat="server">
        <asp:TreeView ID="TreeView1" runat="server" ShowCheckBoxes="All">
            <Nodes>
                <asp:TreeNode Text="学院" Value="学院">
                    <asp:TreeNode Text="工商学院" Value="工商学院"></asp:TreeNode>
                    <asp:TreeNode Text="计算机学院" Value="计算机学院"></asp:TreeNode>
                </asp:TreeNode>
                <asp:TreeNode Text="市" Value="市">
                    <asp:TreeNode Text="济南市" Value="济南市">
                        <asp:TreeNode Text="历城区" Value="历城区"></asp:TreeNode>
                        <asp:TreeNode Text="章丘市" Value="章丘市"></asp:TreeNode>
                    </asp:TreeNode>
                    <asp:TreeNode Text="济宁市" Value="济宁市"></asp:TreeNode>
                </asp:TreeNode>
            </Nodes>
        </asp:TreeView>
  
    </div>
    <asp:Button ID="Button1" runat="server" Text="Button"  />
    </form>

</body>
</html>

原文地址:https://www.cnblogs.com/standy225/p/2602427.html