bonjour
j'ai un petit voir gros probléme
j'utilise un script javascript pour afficher un bouton
mon probléme est que lorsque j'essaye d'afficher plusieurs boiuton issue de la meme classe le script ne s'execute plus correctement
voici le code
bouton_close.js
theImage = new Array()
function BtnClose(x, y, stringurl, enable)
{
this.x=x;
this.y=y;
this.stringurl=stringurl;
this.enable=enable;
this.view=view;
}
function view()
{
name = new Array();
if(this.enable=="true")
{
for(i=1;i<4;i++)
{
theImage[i] = new Image()
theImage[i].src = "button_close_"+i+".png"
}
with (this) document.write("<span style=\"position:absolute;top:"+y+";left:"+x+"\"><img name=animation src=\"button_close_1.png\" target=\"bouton\" onMouseOver=BtnDess() onMouseOut=BtnNorm() onMouseDown=BtnApp() onMouseUp=BtnDess() onClick=MSVGo(\""+stringurl+"\")></span>")
}else{
with (this) document.write("<span style=\"position:absolute;top:"+y+";left:"+x+"\"><img name=animation src=\"button_close_1.png\"></span>");
}
}
function BtnDess()
{
document.animation.src = theImage[3].src
}
function BtnApp()
{
document.animation.src = theImage[2].src
}
function BtnNorm()
{
document.animation.src = theImage[1].src
}
function MSVGo(stringurl)
{
document.location.href = stringurl
}
index.htm
<html>
<head><title>hello world</title>
<SCRIPT LANGUAGE="javascript" src="lib/button_close.js">
</SCRIPT>
</head>
<body>
<script>
house1=new BtnClose(20, 10, "#", "true");
house12=new BtnClose(200, 100, "#", "true");
house1.view();
house12.view();
</script>
</body>
</html>