zoukankan      html  css  js  c++  java
  • js字符拼接

                        for (var j = 0; j < 9; j++) {
                            eval("if (datas[i].b" + j + " == '1') { b[j-1] = 1; }");
                            eval("if (datas[i].c" + j + " == '1') { c[j-1] = 1; }");
                            eval("if (datas[i].d" + j + " == '1') { d[j-1] = 1; }");
                            eval("if (datas[i].e" + j + " == '1') { e[j-1] = 1; }");
                        }

    效果如下

     //                    if (datas[i].a1 == '1') { a[0] = 1; }
                        //                    if (datas[i].a2 == '1') { a[1] = 1; }
                        //                    if (datas[i].a3 == '1') { a[2] = 1; }
                        //                    if (datas[i].a4 == '1') { a[3] = 1; }
                        //                    if (datas[i].a5 == '1') { a[4] = 1; }
                        //                    if (datas[i].a6 == '1') { a[5] = 1; }
                        //                    if (datas[i].a7 == '1') { a[6] = 1; }
                        //                    if (datas[i].a8 == '1') { a[7] = 1; }
    
                        //                    if (datas[i].b1 == '1') { b[0] = 1; }
                        //                    if (datas[i].b2 == '1') { b[1] = 1; }
                        //                    if (datas[i].b3 == '1') { b[2] = 1; }
                        //                    if (datas[i].b4 == '1') { b[3] = 1; }
                        //                    if (datas[i].b5 == '1') { b[4] = 1; }
                        //                    if (datas[i].b6 == '1') { b[5] = 1; }
                        //                    if (datas[i].b7 == '1') { b[6] = 1; }
                        //                    if (datas[i].b8 == '1') { b[7] = 1; }
    
                        //                    if (datas[i].c1 == '1') { c[0] = 1; }
                        //                    if (datas[i].c2 == '1') { c[1] = 1; }
                        //                    if (datas[i].c3 == '1') { c[2] = 1; }
                        //                    if (datas[i].c4 == '1') { c[3] = 1; }
                        //                    if (datas[i].c5 == '1') { c[4] = 1; }
                        //                    if (datas[i].c6 == '1') { c[5] = 1; }
                        //                    if (datas[i].c7 == '1') { c[6] = 1; }
                        //                    if (datas[i].c8 == '1') { c[7] = 1; }
    
                        //                    if (datas[i].d1 == '1') { d[0] = 1; }
                        //                    if (datas[i].d2 == '1') { d[1] = 1; }
                        //                    if (datas[i].d3 == '1') { d[2] = 1; }
                        //                    if (datas[i].d4 == '1') { d[3] = 1; }
                        //                    if (datas[i].d5 == '1') { d[4] = 1; }
                        //                    if (datas[i].d6 == '1') { d[5] = 1; }
                        //                    if (datas[i].d7 == '1') { d[6] = 1; }
                        //                    if (datas[i].d8 == '1') { d[7] = 1; }
    
                        //                    if (datas[i].e1 == '1') { e[0] = 1; }
                        //                    if (datas[i].e2 == '1') { e[1] = 1; }
                        //                    if (datas[i].e3 == '1') { e[2] = 1; }
                        //                    if (datas[i].e4 == '1') { e[3] = 1; }
                        //                    if (datas[i].e5 == '1') { e[4] = 1; }
                        //                    if (datas[i].e6 == '1') { e[5] = 1; }
                        //                    if (datas[i].e7 == '1') { e[6] = 1; }
                        //                    if (datas[i].e8 == '1') { e[7] = 1; }
    剩下的自己发挥了
  • 相关阅读:
    iOS 10 因苹果健康导致闪退 crash-b
    iOS10 配置须知-b
    iOS开发 适配iOS10以及Xcode8-b
    iOS 10 的适配问题-b
    mybatis中分页查询
    mybatis开发流程,增删改查
    spring mvc接收参数方式,json格式返回请求数据
    xml配置文件中常见的命名空间解释
    myeclipse中配置schemaLocation路径,实现xml文件自动提示
    spring MVC工作流程
  • 原文地址:https://www.cnblogs.com/TivonStone/p/3596140.html
Copyright © 2011-2022 走看看