重複の可能性:
配列内の要素をランダム化していますか?
この「Quote Rotator」スクリプトをウェブで見つけましたが、それはうまく機能しますが、リストを循環するだけでなく、引用が表示される順序をランダムにしたいと思います。どんな助けでも大歓迎です。
var myquotes = new Array(
'Quote #1',
'Quote #2',
'Quote #3' // Leave the last quote without a comma at the end
);
function rotatequote()
{
thequote = myquotes.shift(); //Pull the top one
myquotes.push(thequote); //And add it back to the end
document.getElementById('quotetext').innerHTML = thequote;
t=setTimeout("rotatequote()",10000);
}
// Start the first rotation.
rotatequote();