#fcleft"> |
|
| | | | | | | | | | |
This an improved version of the Background changer. Although it does not have the nifty transition shading the other script has, it is a lot shorter. Plus, I've gotten complaints about the past one not allowing you to state any other colors other than the background., which has been fixed in this version. This script also uses color coding, so if you copy the script, be sure to find out what the different colors mean (found below the script source).
The source..
<script language="JavaScript">
<!--
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com
var currentcolor = 0
function initArray(n) {
this.length = n;
for (var i =1; i <= n; i++) {
this[i] = ' '
}
}
bgcolors = new initArray(15)
bgcolors[0]="ffffff"
bgcolors[1]="ffdead"
bgcolors[2]="ffffff"
bgcolors[3]="add8e6"
bgcolors[4]="0000ff"
bgcolors[5]="add8e6"
bgcolors[6]="90ee90"
bgcolors[7]="00ff00"
bgcolors[8]="90ee90"
bgcolors[9]="ffc0cb"
bgcolors[10]="ff0000"
bgcolors[11]="ffc0cb"
bgcolors[12]="FFFFFF"
bgcolors[13]="ffdead"
bgcolors[14]="FFFFFF"
function backgroundChanger() {
document.bgColor = bgcolors[currentcolor];
if (currentcolor < bgcolors.length-1) {
currentcolor++
setTimeout("backgroundChanger()", 100);
}
}
backgroundChanger();
//-->
</script>
Color coding..
This is the number of different background changes you have. Colors are stated by bgcolors[the number in line -1]="your 6 digit background hex characters" so you can add or subtract the number of background changes by knowing this.
This is how frequently the background color changes. 1000 means a one second change between colors, so thus the 100 above would mean change every 1/10 of a second. You can change the script to fit your needs accordingly.