DEMONSTRATION :
Faire afficher des messages rotatifs :
INSTALLATION DU SCRIPT :
Le code à insérer dans la partie
<HEAD>
et
</HEAD>
:
<script language="JavaScript"> <!-- /************************************************************************* * APPLICATION : Faire afficher des messages rotatifs * * RECUPERE A L ADRESSE : http://www.asi.fr/~ericbon/htmldoc.htm * **************************************************************************/ function update(msg) { CurrentMsg = msg; document.rotatif.RotaMsg.value = CurrentMsg; clearTimeout(timer); timer = setTimeout("idleMsg()",3000); } function MakeArray(n) { this.length=n; for(var i = 1; i<= n; i++) { this[i] = ""; } return(this); } var index = 1; var notice_num = 4; // changer la valeur en fonction du nombre de messages var notices = new MakeArray(notice_num); notices[1] = "Une recherche par Yahoo ? www.yahoo.fr"; notices[2] = "Envie d'une pizza ? www.pizza.com"; notices[3] = "Besoin d'aide ? www.perdu.com"; notices[4] = "Go Microsoft ? www.microsoft.com"; var timer = setTimeout('idleMsg()',3000); function idleMsg() { update(notices[index++]); if(index>notice_num) { index=1; } } // --> </script>
Le code à insérer dans l'instruction
<BODY>
:
Le code à insérer dans la partie
<BODY>
et
</BODY>
:
<form name="rotatif"> <input type="text" name="RotaMsg" size="47" VALUE=""> </form>