zoukankan      html  css  js  c++  java
  • Jquery控件checkboxlist 实例,解决前台操作服务器控件的困难

            var chbarray = [];
            var globalarrary = [];
            $(document).ready(function() {
    
                //将所有checkbox找出,加入到数组
                $("#OrgPermissContainer tr td input[type='checkbox']").each(function(i, item) {
                    chbarray.push({ name: $(item).next()[0].innerHTML, value: item });
                });
                //将所有checkbox找出,加入到数组
                $("#globalPermissionContainer tr td input[type='checkbox']").each(function(i, item) {
                    chbarray.push({ name: $(item).next()[0].innerHTML, value: item });
                });
    
                //为所有的checkbox添加事件
                $("#globalPermissionContainer tr td input[type='checkbox']").click(function() {
                    //处理每一个checkbox的单击事件
                    var strId = $(this).next()[0].innerHTML;
    
    
                    if (strId == "添加组织" || strId == '修改组织信息' || strId == '删除组织') {
                        //遍历checkbox数组
                 
                        $.each(chbarray, function(i, ele) {
                            if (ele.name == "查看组织信息") {
    
                                ele.value.checked = true;
    
                            }
                        });
                    }
                    if (strId == "添加用户" || strId == '修改用户信息' || strId == '删除用户') {
    
                        $.each(chbarray, function(i, ele) {
                            if (ele.name == "查看用户信息") {
    
                                ele.value.checked = true;
    
                            }
                        });
                    }
    
                });
                
                //为所有的checkbox添加事件
                $("#OrgPermissContainer tr td input[type='checkbox']").click(function() {
                    //处理每一个checkbox的单击事件
                    var strId = $(this).next()[0].innerHTML;
    
    
                    if (strId == "添加组织" || strId == '修改组织信息' || strId == '删除组织') {
                        //遍历checkbox数组
                        /*for(var i=0;i<chbarray.length;i++)
                        {
                        if(chbarray[i].name=="查看组织信息")
                        {
                        chbarray[i].value.checked=true; 
                        }
                        }*/
                        $.each(chbarray, function(i, ele) {
                            if (ele.name == "查看组织信息") {
    
                                ele.value.checked = true;
    
                            }
                        });
                    }
                    if (strId == "添加用户" || strId == '修改用户信息' || strId == '删除用户') {
    
                        $.each(chbarray, function(i, ele) {
                            if (ele.name == "查看用户信息") {
    
                                ele.value.checked = true;
    
                            }
                        });
                    }
    
                });
    
    
    
            });
    
            
        </script>
    

      

  • 相关阅读:
    利用进制转换压缩数字
    一个不错的移动政务网站
    系统缓存全解析(转摘)
    GeoDatabase元数据不能编辑的问题“The application is not licensed to perform this operation ”
    RSA算法的分析与实现(转载)
    云计算经济学
    Memcached在Windows操作系统下多实例并存(转载)
    AGS FlexView 与 ArcGIS Server的FeatureLayer交互的过程
    转载>ArcEngine中版本的使用
    基于ArcEngine的地图四着色算法的实现(转载)
  • 原文地址:https://www.cnblogs.com/sunjunlin/p/2125761.html
Copyright © 2011-2022 走看看