Exercise Javascript Setup
Before you begin, go File...Save As this Wordpad document
to your Exercise Folder on your harddrive. Save as Firstname.LastName.exjssetup.htm.
Now, begin your work on your harddrive copy.
Here is a javascript set of statements. If you create the proper setup html tags for this script it will work on this page(you will know it worked because your page will shimmy with colors, very ugly!). Insert the following javascript code into the head of this page with the proper html code to make this javascript work:
var pos = 10;
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}
var col=new initArray("4b","5b","8b","8b");
function stop() {
document.bgColor = '#FFFFFF';
clearTimeout(loopID);
}
function start() {
col[1]="red"
col[2]="yellowgreen"
col[3]="yellow"
col[4]="whitesmoke"
col[5]="white"
col[6]="wheat"
col[7]="violet"
col[8]="turquoise"
col[9]="tomato"
col[10]="thistle"
pos++;
if (pos<0||pos>10) {
pos = 0;
}
document.bgColor = col[pos];
loopID = setTimeout("start()",50);
}
The following code should be inserted as an attribute of the body tag of this document. It is called an "event handler".
onLoad="start()"
Save this html document into the Exercise JSSetup Folder on the server.
Do a File....Save As....Firstname.Lastname.exjssetup.htm an extra copy of your completed document into
the Exercises JSSetup folder on the server. Open up your exercise on the server in a browser to make sure it appears the way your want it.