Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Вопрос по jquery switch-case, не пойму где ошибка (https://javascript.ru/forum/jquery/67301-vopros-po-jquery-switch-case-ne-pojjmu-gde-oshibka.html)

SaM1001 10.02.2017 12:45

Запарился я вчера с этой функцией, переписал её по другому, но не пойму почему она только один раз проходит, хотя у меня в объекте три позиции. Может кто поймёт на вскидку?

var img = self.devices.allDevices[self.macAdresses[0]].DeviceInfoDataI;
            if (img != undefined && txt != undefined) {
                img = new Object();
                txt = new Object();
            img[01] = img[02] = img[03] = "<img src=\"../image/gk/img1.png\" height=\"40\" width=\"40\">";
            img[04] = img[05] = img[06] = "<img src=\"../image/gk/img2.png\" height=\"40\" width=\"40\">";
            img[07] = img[08] = img[09] = "<img src=\"../image/gk/img3.png\" height=\"40\" width=\"40\">";
            img[10] = img[11] = img[12] = "<img src=\"../image/gk/dummy.png\" height=\"40\" width=\"40\">";

            txt[1] = txt[2] = txt[3] = "test0";
            txt[4] = txt[5] = txt[6] = "test1";
            txt[7] = txt[8] = txt[9] = "test2";
            txt[10] = txt[11] = txt[12] = "test3";
                
            $('#image').html(img[arr[i].GK]);
            $('#fmtitle').html(txt[arr[i].GK]);              
        }
        else {
            img[0] = img[31] = "<img src=\"../image/gk/dummy.png\" height=\"40\" width=\"40\">";
            txt[0] = "DUMMY";
            txt[31] = "BROADCAST";

            $('#image').html(img[arr[i].GK]);
            $('#fmtitle').html(txt[arr[i].GK]);
        }
    });



UPD: Проходит вроде полностью но цепляет последний объект, а не все, как мне хочется(((


Часовой пояс GMT +3, время: 08:52.