What langauge? This'd be easily achived in Javascript although I'd recomend you do it with PHP, ASP, asp.NET, JSP, Perl, CGI or whatever.
Disclaimer. (1) Whilst I will help you sometimes, if I feel like it, and my advice in relation to your actual question will be of good quality: my posts are to be taken with a pinch of salt. I will be sarcastic, deploy irony and include obscure cultural references for my own amusement without warning.
(2) You will gain nothing from complaining, and if you try to argue with me then you will not win. No matter how noble your battle seems, I am still better than you, don't be an hero.
$choice = $text[ran(1,count($text))];
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>My opinoin on PHP</title>
</head>
<body>
<p>I must say, I <?=$choice ?> <abbr title="HyperText Preprosessor">PHP</abbr> don't you?</p>
</body>
</html>
Last edited by the tree; 04-01-2005 at 10:14 AM.
Disclaimer. (1) Whilst I will help you sometimes, if I feel like it, and my advice in relation to your actual question will be of good quality: my posts are to be taken with a pinch of salt. I will be sarcastic, deploy irony and include obscure cultural references for my own amusement without warning.
(2) You will gain nothing from complaining, and if you try to argue with me then you will not win. No matter how noble your battle seems, I am still better than you, don't be an hero.
Most people don't check this, but if you search the JavaScript Forum with the keywords "random text" you'll find multiple ways to set up content arrays and have them display at random. Searching for your queries first can usually be a valuable and faster way to have them answered, especially if they are very general.
This is what I have used. It includes an author array but that can be taken out and changed. Hope this helps.
Code:
<SCRIPT LANGUAGE="JavaScript">
//store the quotations in arrays
quotes = new Array(6);
authors = new Array(6);
quotes[0] = "The members of the Lone Star Scouts RV Club would like to thank you and your staff for the hospitality extended to us during our rally at your RV Park.”";
authors[0] = "Tom Fausnacht - President Lone Star Scouts RV Club";
quotes[1] = "Your facilities are picture postcard type. Your RV Sites are clean, neat and level. Your Hall couldn’t have been any better. Thanks again for providing a great location for our rally.";
authors[1] = "Herb and Gretta Lucas - Lone Star Bounder";
quotes[2] = "Your new sign looks really great!!!!! Man, you guys are really making this a great park!!!! Hard work is paying off in eyeball appeal!!!";
authors[2] = "Debbie Dominguez";
quotes[3] = "Wonderful place to come. Dorothy, Joe and all the staff are so polite and helpful.";
authors[3] = "Jalanette and Harold Lewis";
quotes[4] = "We love this place! It was easy to find. The bathrooms were really clean and the free movies were great. They also have really good soda.";
authors[4] = "Unknown Child";
quotes[5] = "Eddie and I have really enjoyed our stay at the RV Ranch. Your wonderful personality brightened some very difficult days. Thank you for your support and encouragement...";
authors[5] = "Eddie and Kathy";
quotes[6] = "Dorothy is so kind and goes the extra mile to see that our needs have been met. Joe is ready and willing no matter how cold it is... You won’t be dissatisfied with your stay...";
authors[6] = "Tony and Stacy Padgett";
quotes[7] = "We always enjoy staying here at the RV Ranch. The people are friendly and very helpful. The surroundings are beautiful and kept spotless.";
authors[7] = "Terry and Melissa Hann";
quotes[8] = "We love you Dorothy more than you will ever know. You are like family!!! We’ll Be Backkkkkkkkkk!!";
authors[8] = "Donna and Dean";
//calculate a random index
index = Math.floor(Math.random() * quotes.length);
//display the quotation
document.write("<DL>\n");
document.write("<DT><H6>" + "\" " + quotes[index] + "\"\n");
document.write("<DD>" + "-- " + authors[index] + "\n");
document.write("</DL>\n");
//done
</SCRIPT>
I've done an image in ASP, you can have the code if you want, all it does is redirect the users current page(or rather an image) to one based on the current day, I'm sure you could change it to use a random number.
If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
The same applies to HTML and the forums [HTML][/HTML] tags.
Bookmarks