|
Script Introduction
This script will show an alert with a random quote from a set of 10 when the viewer clicks a button.
Cut and Paste Code: HEAD Section
This code should be placed between the <head> and </head> tags.
Cut and Paste Code: BODY Section
This code should be placed between the <body> and </body> tags.
Installation Instructions
-
Paste the HEAD Section code from above between the <head> and </head> tags on your page.
-
Paste the BODY Section code from above between the <body> and </body> tags on your page,
exactly where you want the button to appear.
-
Find the matching lines below in the script and change the text in red to
the text you wish to use:
quote[0]="Quote #1";
quote[1]="Quote #2";
quote[2]="Quote #3";
quote[3]="Quote #4";
quote[4]="Quote #5";
quote[5]="Quote #6";
quote[6]="Quote #7";
quote[7]="Quote #8";
quote[8]="Quote #9";
quote[9]="Quote #10";
<input type="button" value="Get a Quote!" onClick="getaQuote()">
NOTE: If you need to use "
or ' within a quote, you will need to
write them as \" and \'
instead in order to avoid JavaScript errors.
-
Check the Format Window
to be sure you do not have one single line of code, or too many line breaks in the code.
Example
A working sample of the script is shown below.
Click the button to test the script.
|