Random Quote - More Than 10



Put this part in the part of your document.

<script language="JavaScript">
<!-- Hide from old browsers
// Copyright © 1999 Doug Popeney
// Created by Doug Popeney (easyjava@easyjavascipt.com)
// JavaScript Made Easy!! - http://www.easyjavascript.com

var quotenumber = 14 ;
var randomnumber = Math.random() ;
var rand1 = Math.round( (quotenumber-1) * randomnumber) + 1 ;
quotes = new Array
quotes[1] = "MESSAGE #1"
quotes[2] = "MESSAGE #2"
quotes[3] = "MESSAGE #3"
quotes[4] = "MESSAGE #4"
quotes[5] = "MESSAGE #5"
quotes[6] = "MESSAGE #6"
quotes[7] = "MESSAGE #7"
quotes[8] = "MESSAGE #8"
quotes[9] = "MESSAGE #9"
quotes[10] = "MESSAGE #10"
quotes[11] = "MESSAGE #11"
quotes[12] = "MESSAGE #12"
quotes[13] = "MESSAGE #13"
quotes[14] = "MESSAGE #14"
var quote = quotes[rand1]
// -- End Hiding Here -->
</script>
Now put this part in the body of your document.

<script language="JavaScript">
<!-- Hide this script from old browsers --
document.write("<i>" + quote + "</i>")
// -- End Hiding Here -->
</script>
If you want to add more than 14 quotes, you would insert this line...(it goes after quote 14)

quotes[15] = "MESSAGE #15"
You then need to change quotenumber = 14 to quotenumber = 15. The same goes for adding more and more quotes.

You can add other font characteristics to the quote. In the line, document.write("<i>" + quote + "</i>") the quote is italisized. In the quotations you may add any other type of tag like <STRONG></STRONG> or <U></U>.




JavaScript Made Easy - Main Page