Bonjour ,
j'ai un ptit prob pour afficher le contenu d'une variable avec innerHTML
en fait j'ai une image
puis la fonction ajouterCode:<img id="en" src="images/anglais.jpg" onclick=ajouter("en");>
le prob est que quand je fais ca comme ca cela m'affiche "en" en chaine de caractere et ne comprend pas que c'est le contenu de la variable en qu'il faut afficherCode:
1
2
3
4
5
6
7
8
9
10
11 function ajouter(obj) { en="<div id='Layer1' style='position:absolute; left:110px; top:100px; width:403px; height:86px; z-index:1'>hello</div>"; alert(obj)// affiche "en" document.getElementById("Layer3").innerHTML = obj; }
pourtant quand je fais
document.getElementById("Layer3").innerHTML = en
cela m'affiche bien le contenu de la variable en