Jump to content


Photo

help with a specified quote script!


  • Please log in to reply
2 replies to this topic

#1 eyesofsociety

eyesofsociety
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 09 July 2006 - 07:24 PM

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>

#2 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 09 July 2006 - 08:35 PM

they are not the same mate....

they rotate different things all the time

#3 eyesofsociety

eyesofsociety
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 09 July 2006 - 09:41 PM

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

http://www.thescript...read147385.html

perhaps i need multiple arrays? this page uses multiple arrays

http://codepunk.hard....uk/samp127.htm

but it only rotates upon refresh.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users