View Full Version: [S] Random Quote Code

RPG-Directory > Solved Support Topics > [S] Random Quote Code



Title: [S] Random Quote Code


Kitay` - August 13, 2008 12:58 AM (GMT)
hey, sorry if this has been answered- but i'm looking for a code that would basically generate a random code that changed when you refreshed/changed pages~ er, basically like what they have on the Fictionalley forums xD; i was wondering if anyone either knew the code or where to get it, if it exists?

thanks!

pathogenicoma - August 13, 2008 01:06 AM (GMT)
I have a changing quote code on my forum. I can give you that.

CODE
<SCRIPT language=Javascript>
function text() {
};

text = new text();
number = 0;

// textArray
text[number++] = "Your quote could be here."


// keep adding items here...

increment = Math.floor(Math.random() * number);

document.write(text[increment]);

//--></SCRIPT>


You just keep adding text[number++] = "Your quote could be here." one beneath the other, not need for BR tags. You have to have the quotes there, so if you're going to have speak in the quote, us ' instead of " otherwise it might cause coding issues.

Kitay` - August 13, 2008 01:18 AM (GMT)
that works, thank you so much <3

pathogenicoma - August 13, 2008 01:23 AM (GMT)
You're welcome!




Hosted for free by InvisionFree