|
Web Design Tips
FrontPage Universe Tips
Add
a Random Quote to your Webpage
Here is a simple Javascript code snippet that you can add to your
webpage that will produce a random quote every time the page loads.
You can add the quotes that you would like to have displayed to the
new array area and the script will call as needed.
This part of the script goes between the <head> and </head> tags of
your webpage.
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
// Add the quotes you wish to use here. Ensure you use exactly
// the same format or the code will break.
quotes = new Array("Now is the Best Time to Get
Frontpageuniverse Hosting",
"frontPageuniverse has the best WebTools on the Internet",
"FrontPageuniverse Members Rock",
"Get your own Membership at FrontPageuniverse.com")
brave = quotes.length
function randQuote(){
randomNum = Math.floor
((Math.random() * brave))
document.mesays.quoterot.value = quotes[randomNum]
}
</SCRIPT>
This line of code replaces your <body> tag on your webpage.
<BODY onLoad="randQuote()">
Place this part of the script on your page where you would like the
quotes to appear. Feel free to modify this to suit your website.
<div align="center">
<!-- in the form below adjust the 'size' as needed to ensure your
quotes will fit. The 'style' can be eliminated or modified to suit
your own website. Hope you enjoy this script. -->
<FORM name="mesays">
<INPUT type="text" name="quoterot" size="55" style="font:bold 11px
verdana;color:#FFFFFF;background-color:#FF0000;">
</FORM>
</div>
|