Click to See Complete Forum and Search --> : Random Text Displaying


PhantomOTO
05-04-2007, 10:42 AM
Hi all,

If there is someone that can help me, that would be great! I am trying to find a code that will display a different quote every time the page is refreshed or someone goes to a different link. I have something that works for randomly displayed images, but that doesn't always change when the page is refreshed and that would mean I would have to create a lot of different images. It would be nice to be able to list the quotes out in a .txt file and then have the pages reference the file to pull a quote out everytime. The quote format will be:

"Thank you very much!"
- Mike

Does anyone have anything that would work???

Michael

ryanbutler
05-04-2007, 12:41 PM
See if this link helps:

http://www.hotscripts.com/PHP/Scripts_and_Programs/Quote_Display/index.html

hummer59
05-24-2007, 11:19 AM
here is a script that works well just replace my quote stuff. and place the follwing in the <body> of where you want to place the quote,

<script language="javascript" src="quotes.js">

The following is place in a seperate js file. Hope this is what you want.

var num_of_quotes = 4;
quotes = Math.floor (num_of_quotes * Math.random());


if (quotes==0) {
title="the quoted person";
body="What they said.";
}

if (quotes==1) {
title="the quoted person";
body="What they said.";
}

if (quotes==2) {
title="the quoted person";
body="What they said.";
}

if (quotes==3) {
title="the quoted person";
body="What they said.";
}

function showquote() {
document.write(''+ body +'');
document.write('<br>');
document.write('<p style="margin-right: 20" align="right"><strong>' + title + '</strong><br></p>');
}


showquote();