<html> <head> <title>Texte qui rebondit</title> <script LANGUAGE="JavaScript"> <!-- var texte = "Le texte à faire défiler est à mettre ici..."; var nbEspaces = 20; var i = 0; while (i++ < nbEspaces) texte = " " + texte; var timerID = null; var pos = nbEspaces; var direction = -1; //+1 = droite, -1 = gauche var delaiScroll = 75; function startScroll() { var msg; if (pos == nbEspaces) direction = -1; if (pos == 0) direction = 1; pos += direction; msg = texte.substring(pos,texte.length); window.status = msg; window.document.formScroll.textScroll.value = msg; timerID = setTimeout("startScroll()", delaiScroll); } function stopScroll() { clearTimeout(timerID); window.status = ''; } //--> </script> </head> <body onLoad="startScroll()" onUnLoad="stopScroll()"> <h1 align="center">Texte qui rebondit</h1> <hr> <form name="formScroll"> <p><input type="text" name="textScroll" style="font-family: Courier New" size="64"></p> </form> </body> </html> |
retour au menu des textes défilants