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>
    

      

  • 相关阅读:
    SQLite常用SQL语句
    delphi设计浮动窗口
    在Delphi中使用键盘勾子获取键盘输入(译--5月7日)
    Delphi制作软键盘
    Delphi格式化输出函数(1): Format
    《你不知道的 CSS》之等比例缩放的盒子
    请用心练完这16个webpack小例子
    JavaScript高级内容笔记:原型链、继承、执行上下文、作用域链、闭包
    表格组件神器:bootstrap table详细使用指南
    玩转JavaScript正则表达式
  • 原文地址:https://www.cnblogs.com/sunjunlin/p/2125761.html
Copyright © 2011-2022 走看看