Site hosted by Angelfire.com: Build your free website today!

Here's the random quote:

THE SOURCE:
------------------------------------------------------------------

//set the up an array so put
the quotes in! :)//

var quotes= new Array()


quotes[0]='"Anger, fear, agression, the

Dark Side are they..."<i>-Yoda</i>'

quotes[1]='"The Force will be
with you..always!"<i>-Star Wars</i>'

quotes[2]='"Keep your concentration
here and now where it belongs" <i>-Qui-Gon
Jinn </i>'

quotes[3]='"Hard to see the Dark
Side is.... <i>-Yoda</i>"'

var whichquote = Math.floor
(Math.random()*(quotes.length))
document.write(quotes[whichquote])

EXPLANATION:

 Ok, well if you fist look at the page source, you will notice that the JavaScript is not encoded into the HTML <SCRIPT> page. This I did in order to ensure that people don't steal the script. Very easily done just by adding the "src" attribute. Then we go into quote.js and do the fun stuff ^_^

Very first thing that I did, was set up an array.

var quotes = new Array() blah blah blah

Then I numbered off from 0 to 3, all in all getting 4 elements: 0, 1, 2, 3, 4.

The last part of the script is actually where the main part to generate the random number. I used the Math.floor(), instead of Math.round(), is used in the above code. While both successfully rounding off its containing parameter to an integer within the designated range, Math.floor does so more "evenly", so the resulting integer isn't lopsided towards either end of the number spectrum. In other words, a more random number is returned using Math.floor().

So then I just told it to write the random quote into the HTML page by using document.write. That's it! ^_^