Unofficial Tips and Tutorials for Homestead SiteBuilder™ Users


Home - Tips & Tutorials - JavaScript Demos - Java Applet Demos - Resources - Contact

Fortune Cookie Script adapted from Quotes Script by Bravenet

I've been using this script on my personal page for a few months now, using a rotating set of real fortune cookie fortunes. To the right, you'll see the first set of fortunes. You can always use fortunes you get from cookies when you visit a Chinese or other Asian restaurant, even get them from your family and friends. They may think you're nuts, but who cares, right? If you make changes to the script, be sure you keep each quotation on its own line. Only change what's between the quotation marks ("") and up to five fortunes. And yes, this has been tested on a SiteBuilder Classic page.

My stash of fortunes is now up to 10 scripts! If you would like to get all 10 fortunes in plain text format conveniently zipped, click this link to the download page. I've also put the scripts on that page for those of you who don't have WinZip or other similar utility. You'll have to copy-and-paste the scripts into NotePad or a similar plain text application to save the scripts.

1) For Homestead SiteBuilder Classic users, copy-and-paste the following script in an Insert HTML element, minimize it, and move it to the upper left corner of your page. This part normally goes between the <head> and </head> tags and consists of the actual fortunes. Everyone else can simply put this part between the <head> tags.

<script>
//fcs1
var Quotation=new Array()
Quotation[0] = "You will discover the truth in time.";
Quotation[1] = "Remember to share good fortune as well as bad with your friends.";
Quotation[2] = "You should be able to make money and hold on to it.";
Quotation[3] = "A good time to start something new.";
Quotation[4] = "A handful of patience is worth more than a bushel of brains.";
var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));
function showQuotation() {
document.write(Quotation[whichQuotation]);}
</script>

2) Then, on the body of your page where you want the fortunes to appear put the following script into another Insert HTML element. Everyone else can put this anywhere in the body of your page.

<p><font face="Arial,Helvetica,Verdana" size="2"><script> showQuotation(); </script></font></p>

You can change the font face and size to suit your web page. Leave out the font attributes if you want the fortunes text to be the same as what you defined on your web page. If you want to make it seem like the fortune appears on a strip of paper, place the above script in a table with a white background and a 1 pixel border as shown below.

Here's Your Fortune!

Refresh or reload page for a new fortune.

Formerly hosted at
www.geocities.com/ramblingtutor/

Home - Tips & Tutorials - JavaScript Demos - Java Demos - Resources - Contact

Webpage graphics by Arride Graphics
Copyright © 2000- Rambling Tutor and JanetS
All Rights Reserved
All other copyrights belong to their respective owners as noted.


Plus 260 visitors before joining Site Meter on June 11, 2001