DEMONSTRATION :
Affichage d'une citation aléatoire (recharger plusieurs fois la page) :
INSTALLATION DU SCRIPT :
Le code à insérer dans la partie
<HEAD>
et
</HEAD>
:
Le code à insérer dans l'instruction
<BODY>
:
Le code à insérer dans la partie
<BODY>
et
</BODY>
:
<SCRIPT LANGUAGE="JavaScript"> <!-- /************************************************************************* * APPLICATION : Affichage d'une citation aleatoire * * RECUPERE A L ADRESSE : http://www.asi.fr/~ericbon/htmldoc.htm * **************************************************************************/ quotes = new Array(6); authors = new Array(6); quotes[0] = "I have a new philosophy. I am only going to dread one day at a time."; authors[0] = "Charles Schulz"; quotes[1] = "Reality is the leading cause of stress for those in touch with it."; authors[1] = "Jack Wagner"; quotes[2] = "Few things are harder to put up with than the annoyance of a good example."; authors[2] = "Mark Twain"; quotes[3] = "The pure and simple truth is rarely pure and never simple."; authors[3] = "Oscar Wilde"; quotes[4] = "There is no business like show business, but there are several businesses like accounting."; authors[4] = "David Letterman"; quotes[5] = "Man invented language to satisfy his deep need to complain."; authors[5] = "Lily Tomlin"; //calcul d'une position aléatoire index = Math.floor(Math.random() * quotes.length); //affichage du résultat document.write("<B>" + quotes[index] + "</B><BR>"); document.write("<I>" + authors[index] + "</I>"); //--> </SCRIPT>