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>
    

      

  • 相关阅读:
    http数据返回值
    刷新 返回
    微信平台上遇到的bug
    iscroll修改
    iscroll
    a标签的herf和click事件
    ios9+xcode7 适配笔记
    xsd、wsdl生成C#类的命令行工具使用方法
    xcode更新,想想也是醉了
    关于#define预处理指令的一个问题
  • 原文地址:https://www.cnblogs.com/sunjunlin/p/2125761.html
Copyright © 2011-2022 走看看