bonjour
Je veux faire une animation avec des photos qui défilent en boucle, jusque là pas de problème, ca marche.
Et j'aimerais en faire plusieurs sur une meme page.
Donc j'ai rajouté des images dans mon tableau et les fonctions pour la 2e animation. Et là, ca ne marche plus:
je t'envoie le code, pour voir :
<head>
//fonctions pour la 1e animation
i = new Array;
version = navigator.appVersion.substring(0,1);
if (version >= 3)
{
i0 = new Image;
i0.src = 'animation1/photo1.jpg';
i[0] = i0.src;
i1 = new Image;
i1.src = 'animation1/photo2.jpg';
i[1] = i1.src;
i2 = new Image;
i2.src = 'animation1/photo3.jpg';
i[2] = i2.src;
i3 = new Image;
i3.src = 'animation1/photo4.jpg';
i[3] = i3.src;
i4 = new Image;
i4.src = 'animation1/photo5.jpg';
i[4] = i4.src;
i5 = new Image;
i5.src = 'animation2/photo1.jpg';
i[5] = i5.src;
i6 = new Image;
i6.src = 'animation2/photo2.jpg';
i[6] = i6.src;
i7 = new Image;
i7.src = 'animation2/photo3.jpg';
i[7] = i7.src;
i8 = new Image;
i8.src = 'animation2/photo4.jpg';
i[8] = i8.src;
i9 = new Image;
i9.src = 'animation2/photo5.jpg';
i[9] = i9.src;
}
a = 0;
function StartAnim()
{
if (version >= 3)
{
document.write('<IMG SRC="animation1/photo1.jpg" width="201" height="134" BORDER=1 NAME=defil>');
defilimg()
}
else
{
document.write('<IMG SRC="animation1/photo1.jpg" width="201" height="134" BORDER=1>')
}
}
function defilimg()
{
if (a == 5)
{
a = 0;
}
if (version >= 3)
{
document.defil.src = i[a];
tempo3 = setTimeout("defilimg()",2000);
a++;
}
}
//fonction pour la 2e animation
b = 5;
function StartAnim2()
{
if (version >= 3)
{
document.write('<IMG SRC="animation2/photo1.jpg" width="201" height="134" BORDER=1 NAME=defil>');
defilimg2()
}
else
{
document.write('<IMG SRC="animation2/photo1.jpg" width="201" height="134" BORDER=1>')
}
}
function defilimg2()
{
if (b == 9)
{
b = 5;
}
if (version >= 3)
{
document.defil.src = i[b];
tempo3 = setTimeout("defilimg2()",2000);
b++;
}
}
</SCRIPT>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
StartAnim();
StartAnim2();
</SCRIPT>
</body>
voilà, si tu peux regader, merci
fanouille