JS does not work (SOLVED)

Why are you saying it does not work? What does happen?
I saw a reference to an image file: im.src=‘01.png’; Is this file compiled inside the application?

Hello,

I use a script in a js page, but it does not work after compilation. What’s wrong?

Here’s the script:

JS :

    var controler={
        openpic:function(x){        
            var pic=document.getElementById('picture'),           
            st=x.length, n=x.substr(2,st),
            im=new Image();
            im.onload=function(){                
                pic.appendChild(im);
            };            
            im.src='01.png';
        }
    };
    window.onload=function(){
        (function(){            
            var menu=document.getElementById('menu'),
            bt=menu.getElementsByTagName('option'),cbt=bt.length;
            for(var y=0;y<cbt;y++){
                bt[y].onclick=function(){                    
                    controler.openpic(this.id);
        };
    	}
        })();  

    };  

HTML :

<select name="ListBox" id="menu">
  <option id="bt1">img1</option>
  <option id="bt2">img2</option>
  </select>  

<div id="picture"></div>  

Thank you
F.

Hello,

Finally it works: an error on the link images. But as it worked partially locally and not after compilation …

Sorry for inconvenience ;-))


VF :
Bonjour,

Finalement ça fonctionne : une erreur sur le lien des images. Mais comme cela fonctionnait partiellement en local et pas après la compilation…

Désolé du dérangement ;-))

Merci
F.

Thanks for the follow-up.