Bonjour tout le monde!
J'y connais pas grand chose au javascript... Voici un script que j'ai trouvé sur internet et adapté pour mon site:
1 2 3 4 5 6 7 8 9 10
| imgs=Array("projets/superman/1.png","projets/superman/2.png","projets/superman/3.png","projets/superman/4.png","projets/superman/5.png");
var x=0;
function change() {
document.getElementById("bob").src=imgs[++x];
if (x==6) {
x=0;
}
} |
<img src="projets/superman/1.png" id="bob" alt="" onmousedown="change()" style="width: 70%" />
Ca marche bien, sauf un petit problème! Regardez içi: ICIII
Une fois cliqué sur la dernière image, c'est comme s'il y avait un lien vers une image suivante qui n'existe pas?... Quelqu'un voit pourquoi ça marche pas? 
Merci d'avance!
Partager