»
English French Vietnamese

Print - Color Wheel - JavaScriptBank.com

Color Wheel © JavaScriptBank.comThis JavaScript code will change the background from one color to the next for each of the 10 colors then it starts the loop over again! There is also an On/Off button to let you start and stop the JavaScript

Full version: jsB@nk » Background » Color Wheel



JavaScript
<script language="javascript">
/*
     This script downloaded from www.JavaScriptBank.com
     Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/

<!-- Begin
// author: Eric Stremming (estremming@hotmail.com)

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);
}
// End -->
</SCRIPT>
	<!--
    	This script downloaded from www.JavaScriptBank.com
    	Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
	-->


HTML
<BODY onload=start()>
<FORM>
	<INPUT onclick='parent.location="javascript:location.reload()"' type=button value=" Turn on ">
	<INPUT onclick=stop() type=button value=" Turn off"> 
</FORM>
</body>
	<!--
    	This script downloaded from www.JavaScriptBank.com
    	Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
	-->