Jump to content


This topic is now archived and is closed to further replies.


help with a specified quote script!

Recommended Posts

Hello. I have here a script that will display 3 different sets of rotating quotations (that rotate every second). What I have been trying to have it do though, is to have distinct content on each three of the quotations (so that quotation one does not use any of the quotes used in quote2, or quote3. This is the script I have for 3 quotations rotating (but they are all rotating the same thing).

<script language="JavaScript">
function rotateEvery(sec)
    var Quotation=new Array()

    Quotation[0] = 'two';
    Quotation[1] = 'three';
    Quotation[2] = 'four';
    Quotation[3] = 'five';
    Quotation[4] = 'six';
    Quotation[5] = 'seven';
    Quotation[6] = 'eight';
    Quotation[7] = 'nine';

    var indices = randoms(3, Quotation.length - 1);

    for (i = 0; i < indices.length; i++) {
      var id = 'textrotator' + i;
      document.getElementById(id).innerHTML = Quotation[indices[ i]];
    setTimeout('rotateEvery('+sec+')', sec*400);

function randoms(howMany, maxValue)
  var values = new Array();
  values[0] = randomInt(maxValue);

  for (i = 1; i < howMany; i++) {
    var j = randomInt(maxValue);
    while (j == values[i - 1]) {
      j = randomInt(maxValue);
    values[ i] = j;

  return values;

function randomInt(max)
  return Math.round(Math.random() * max);
<body onload="rotateEvery(1)">
<div id="textrotator0"></div>
<div id="textrotator1"></div>
<div id="textrotator2"></div>

Share this post

Link to post
Share on other sites
that's correct that they all rotate different things at each time, but they all also overlap each other. i'd like for there to be only sections of the listed quotes going to one text, and the others being assigned to others so all the different texts rotate but none of them overlap each other in content.

i found somebody trying to come up with the same thing --


perhaps i need multiple arrays? this page uses multiple arrays


but it only rotates upon refresh.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.