/    Sign up×
Community /Pin to ProfileBookmark

Does anyone have a script for random text, which isn’t remotely hosted?

to post a comment
Full-stack Developer

7 Comments(s)

Copy linkTweet thisAlerts:
@the_treeMar 31.2005 — 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.
Copy linkTweet thisAlerts:
@tims15authorMar 31.2005 — I can do it in anything, but would prefer javascript
Copy linkTweet thisAlerts:
@the_treeMar 31.2005 — Anything?!?! Who are you hosted by? How did they manage that? I doubt this somehow.

I'm not to familiar with JS, so I'll give you a PHP solution instead, I'm sure someone will come up with one for JS.[code=php]<?php
$text[1] = "love";
$text[2] = "hate";
$text[3] = "have no opinoin regarding";

$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>[/code]
Copy linkTweet thisAlerts:
@gorkyMar 31.2005 — 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.

[url=http://www.webdeveloper.com/forum/showthread.php?t=59188&highlight=random+text]Here is just one example of a result.[/url]
Copy linkTweet thisAlerts:
@tims15authorApr 01.2005 — Thanks very much for your help!
Copy linkTweet thisAlerts:
@Slickwilly9Apr 01.2005 — 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>[/CODE]
Copy linkTweet thisAlerts:
@scragarApr 01.2005 — 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.
×

Success!

Help @tims15 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...