Why is my "RIGHT" not working?

0

I would like a help with RIGHT, I am printing an input field in this array, but every time I click on RIGHT it does not change and it does not show me the correct index print. . I think I'm not browsing through the index ... but I'm kind of confused.

var iAppLib = new IAppLib();
var pagina = "marcaWebkit";
var controle;
var index = 0;
var bt = 0;
var todasAsmarcas = new Array(4);
    todasAsmarcas[0] = new Array("Samsung", "LG", "Sony", "SempToshiba", "Panasonic", "AOC", "CCE", "Philips", "Sharp", "Toshiba", "Gradiente", "Philco", "Buster", "Semp", "Hitachi", "Sanyo", "Blue Sky", "Mitsubishi", "Aiko", "Cineral", "JVC", "Zenith");
    todasAsmarcas[1] = new Array("Samsung", "LG", "Sony", "SempToshiba", "Panasonic", "AOC", "CCE", "Philips", "Sharp", "Toshiba", "Gradiente", "Philco", "Buster", "Hitachi", "Sanyo", "Blue Sky", "Mitsubishi", "Aiko", "Cineral", "JVC", "Zenith");
    todasAsmarcas[2] = new Array("Samsung", "LG", "Sony", "SempToshiba", "Panasonic", "AOC", "CCE", "Philips", "Sharp", "Toshiba", "Gradiente", "Philco", "Buster", "Hitachi", "Sanyo", "Blue Sky", "Mitsubishi", "Aiko", "Cineral", "JVC", "Zenith");
    todasAsmarcas[3] = new Array("Samsung", "LG", "Sony", "SempToshiba", "Panasonic", "AOC", "CCE", "Philips", "Sharp", "Toshiba", "Gradiente", "Philco", "Buster", "Semp", "Hitachi", "Sanyo", "Blue Sky", "Mitsubishi", "Aiko", "Cineral", "JVC", "Zenith");

        function getParameter(valor){
            var search = valor + "=";
            if (document.location.search.length > 0){
                var offset = document.location.search.indexOf(search);
                if (offset != -1){
                    offset += search.length;
                    var end = document.location.search.indexOf("&", offset);
                    if (end == -1) end = document.location.search.length;
                    return 
unescape(document.location.search.substring(offset, end));
                }
            }
            return "";
        }

    var contMenu=getParameter("contMenu");

function initial(x) {   
    document.getElementById("estiloId1")+todasAsmarcas[index];
    var num = index + 1;
    document.querySelector("[name='marca']").value = todasAsmarcas[num];    
    console.log(todasAsmarcas[index]+"marca que deve ser printada dentro do 
input---------");
    //console.log(num+"  numero do meu index que estou chamando de outra 
pagina--------");
}

function onRcu(e) {     
switch (e.keyName) {                
       case iAppLib.keys.OK:
           switch(pagina){
           case "marcaWebkit":
                if(bt == 0){
                    main.avancar();
                }else{
                    voltar();
                }
            break;
           }
            break;      
       case iAppLib.keys.NUMERIC :      
           break;             
       case iAppLib.keys.LEFT :
       switch(pagina){
                case "menuWebkit":
                    if(contMenu > 0){
                        setMenuHighlightOFF(contMenu);
                        contMenu --;
                        setMenuHighlightON(contMenu);                           
                    }
                    break;  
            }
            break;
       case iAppLib.keys.RIGHT : 
           console.log("olá");
           if (index < todasAsmarcas.length - 1) {
                index++; 
                console.log("index----------navegação    "+index);
                initial();
            }  
        }
    e.preventDefault();
}

(function() {      
 var BACKGROUND_PATH;
     if (location.host !== "iapps.local") {      
           BACKGROUND_PATH = 
"/media/volume_model_WDC_WD5000LUCT_6_part_512/bg.mpg";          
     } else { 
           BACKGROUND_PATH = "/dld-tmp/download/iApp/bg2/bg.mpg";
     }

     document.addEventListener("keyup", onRcu);      
     iAppLib.registerRcuEvent(iAppLib.keys.OK);        
     iAppLib.registerRcuEvent(iAppLib.keys.RIGHT);
     iAppLib.registerRcuEvent(iAppLib.keys.LEFT);       
     iAppLib.registerRcuEvent(iAppLib.keys.YELLOW);
     iAppLib.registerRcuEvent(iAppLib.keys.UP);
     iAppLib.registerRcuEvent(iAppLib.keys.DOWN);

     var init = [iAppLib.resize(720, 480, 1280, 720)
                 ,iAppLib.setBackgroundImage(BACKGROUND_PATH,"mpg")                        
                 ];
     Promise.all(init).then(function (results) {          
//           teste12= document.getElementById("myFrame");
            console.log(teste12);


     });
})();
    
asked by anonymous 22.01.2018 / 13:45

0 answers