Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Elemento random da array

    Salve, dovrei estrarre un elemento in modo random da un array per poi farlo cambiare ogni tot secondi tramite SetInterval, ho provato questi codici ma non funzionano:

    codice:
     <HTML>
    <HEAD>
    <TITLE></TITLE>
    <script type ="text/javascript">
    fuction getQuote()
    {
    
    var mtQuotes = new Array();
    
    mtQuotes[0] = "I smoke in moderation, only one cigar at a time.";
    
    mtQuotes[1] = "Be careful of reading health books, you might die of a misprint.";
    
    mtQuotes[2] = "Man is the only animal that blushes or needs to.";
    
    mtQuotes[3] = "Clothes make the man. Naked people have little or no influence on society.";
    
    mtQuotes[4] = "One of the most striking differences between a cat and a lie is that a cat has only nine lives.";
    
    var randValue = Math.floor(Math.random() * mtQuotes.length);
    document.write(mtQuotes[randValue]);
    }
    </script>
    </HEAD>
    <BODY>
    Testa
    </BODY>
    </HTML>
    Ovviamente ora non ha il setinterval, l' ho messo così per vedere se funzionavano ma non vanno .. Cosa c'è di sbagliato?
    Social Network in costruzione.. Misto tra Twitter e Facebook.. Twitbook o facetter?

  2. #2
    fuction getQuote()

    function

  3. #3
    Oddio che errore ahahah mi devo vergognare.

    Grazie
    Social Network in costruzione.. Misto tra Twitter e Facebook.. Twitbook o facetter?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.