... Enter if you dare! if (document.images) {} : s'il existe des images dans le document image1 = new Image; initialiser une variable dans format Image image1.src = "chaine.ext" : Indiquer l'emplacement d'origine de l'image function nom_fonction(attribut, ..., ...) document[name].src => document."enter".src eval(image+".src") additioner une variable de type chaine de caractere (évaluation si c'est une chaine) avec une autre chaine de caractere ===================================

Local Night Spots

<html> <head> <title>cycling banner ads</title> <script type="text/javascript"> if (document.images) { adImages = new Array("hosts/mit.gif", "hosts/inria.gif", "hosts/keio.gif"); adURLs = new Array("www.lcs.mit.edu", "www.inria.fr", "www.keio.ac.jp"); thisAd = 0; } function cycleAds() { if (document.images) { if (document.adBanner.complete) { if (++thisAd == adImages.length) thisAd = 0; document.adBanner.src = adImages[thisAd]; } } // change to next sponsor every 3 seconds setTimeout("cycleAds()", 3000); } function gotoAd() { document.location.href = "http://" + adURLs[thisAd]; } </script> </head> <body onload="cycleAds()"> ... <a href="javascript:gotoAd()"><img name="adBanner" src="hosts/mit.gif" border="0" alt="Our sponsors"></a> adImages = new Array("chaine", "chaine" "chaine"); initialise la variable adImages en tant que tableau de chaine thisAd=0 initialise la variable thisAd à 0 document.adBanner.complete : si le téléchargement de l'image est complete... ++thisAd : thisAd qui valait 0 devient 1 et ensuite on compare l'égalité avec le nombre d'élément dans le tableau adImages adImages[thisAd] l'élément thisAd 0 pour le premier et ainsi de suite... setTimeout("nom_de_la_fonction", valeur en millisecondes) document.location.href = chaine + variable de types chaines...