QQ:1187362408 欢迎技术交流和学习

js中二维数组篇(二维数组篇):

TODO:

1,一位数组声明并初始化如下:

 

var chkProQuery = new Array("ddlPro", "ddlCity", "ddlCoun", "ddlTown", "ddlVill", "ddlGird");//联动select改变对应checkbox控制全选反选  初始化<省市县乡镇村网格[用户角色类别]
var chkNameArray = new Array("protypechk", "citytypechk", "countypechk", "towntypechk", "villtypechk", "girdtypechk");//初始化数组<省市县乡镇村网格[用户角色类别]名称name>

 

2,二位数组声明并初始化如下:

 

var chkNameIdArray = new Array(["protypechk", "protypechk_"], ["citytypechk", "citytypechk_"], ["countypechk", "countypechk_"], ["towntypechk", "towntypechk_"], ["villtypechk", "villtypechk_"], ["girdtypechk", "girdtypechk_"]);//初始化数组<省市县乡镇村网格[用户角色类别]名称name,i
3,二维数组遍历如下:

 

 

/*省市县乡镇村网格[用户角色类别]*/
    var typestr = "";
    $.each(chkNameIdArray, function (value, idex) {
        var typeArray = idex;
        var sArray = "";
        $.each(typeArray, function (value, idex) {
            sArray += idex + ",";
        });
        sArray = sArray.substr(0, sArray.length - 1).split(',');
        typestr += RequiredNameIdCheckbox(sArray[0], sArray[1]) + "^";
    });