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; }
    剩下的自己发挥了
  • 相关阅读:
    javax.servlet.http.HttpServletRequest接口(HTTP版本)
    javax.servlet.http.HttpServletResponse接口(HTTP版本)
    AOP简介AOP是什么?
    javax.servlet.ServletResponse接口(协议无关版本)
    HttpSession接口中的方法(Jsp中的session类的用法)
    网页只允许中国用户访问
    PHP API获取天气预报,以及使用飞信API,给好友发
    php正则表达式抽取email地址函数
    完美解决PHP中文乱码问题
    PHP汉字转换拼音
  • 原文地址:https://www.cnblogs.com/TivonStone/p/3596140.html
Copyright © 2011-2022 走看看