Hello,
I use a script in a js page, but it does not work after compilation. What’s wrong?
Here’s the script:
JS :
HTML :
Thank you
F.
I use a script in a js page, but it does not work after compilation. What’s wrong?
Here’s the script:
JS :
Code:
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);
};
}
})();
};
Code:
<select name="ListBox" id="menu">
<option id="bt1">img1</option>
<option id="bt2">img2</option>
</select>
<div id="picture"></div>
F.
Last edited: