Bonjour et merci de ton aide
Pour ton info j'ai trouvé cette réponse par ailleurs qui fonctionne parfaitement et évite peut être des km de code?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>diapo</title>
<script type="text/javascript">
function diapo(MesImages,cible){
this.cible = cible;
this.MesImages = MesImages;
this.nbImage = MesImages.length;
this.currentIndex = 0 ;
this.timer = null;
}
diapo.prototype.next = function(){
var me = this;
this.currentIndex++;
if (this.currentIndex == (this.nbImage)) this.currentIndex = 0;
this.cible.src = this.MesImages[this.currentIndex];
this.timer = setTimeout(function(){me.next();},1000);
}
diapo.prototype.reset = function(){
this.currentIndex = 0;
clearTimeout(this.timer);
this.cible.src = this.MesImages[0];
}
</script>
</head>
<body>
<a href="#" onmouseover="first.next()" onmouseout="first.reset()">
<img src="images/pic2.jpg" id="premier"/>
</a>
<a href="#" onmouseover="deux.next()" onmouseout="deux.reset()">
<img src="images/pic5.jpg" id="second" />
</a>
<script type="text/javascript">
//création des tableaux d'image + détection de la cible
var first = new diapo(['images/pic2.jpg','images/pic3.jpg','images/pic4.jpg'],document.getElementById('premier'));
var deux = new diapo(['images/pic5.jpg','images/pic6.jpg','images/pic7.jpg'],document.getElementById('second'));
</script>
</body>
</html>