Jump to content

help with a specified quote script!


eyesofsociety

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).

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

    // QUOTATIONS
    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);
}
</script>
</head>
<body onload="rotateEvery(1)">
<div id="textrotator0"></div>
<div id="textrotator1"></div>
<div id="textrotator2"></div>
</body>
Link to comment
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 --

[url=http://www.thescripts.com/forum/thread147385.html]http://www.thescripts.com/forum/thread147385.html[/url]

perhaps i need multiple arrays? this page uses multiple arrays

[url=http://codepunk.hardwar.org.uk/samp127.htm]http://codepunk.hardwar.org.uk/samp127.htm[/url]

but it only rotates upon refresh.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.