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; }
    剩下的自己发挥了
  • 相关阅读:
    Interface Collector
    Package java.util.stream
    Java环境变量配置&解决版本不一致问题 (转)
    数据库事务
    svn:重新设置客户端账户密码
    Mybatis:使用bean传值,当传入值为Null时,提示“无效的列类型”的解决办法
    Spring:在普通Java类中获取由Spring所管理的Bean
    在Eclipse中导入dtd和xsd文件,使XML自动提示(转)
    linux 如何显示一个文件的某几行
    软件质量特征 ISO9126
  • 原文地址:https://www.cnblogs.com/TivonStone/p/3596140.html
Copyright © 2011-2022 走看看