Make your own free website on Tripod.com

Rainbow Background

Sample






Script by Isaac Chau

click the button below to start:

click the botton below to stop:



The Code







Paste the following code between the <HEAD> and </HEAD> tag.

<SCRIPT LANGUAGE="JavaScript">
<!-- Scripts by Isaac Chau,
function toRadian( deg ) {
return ( deg / 180.0 * Math.PI )
}

function toHex( dec ) {
Hex = new Array( "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "E", "E", "F" )
base=16
total=""
for ( i = parseInt(dec, 10) ; i > 0 ; i = parseInt(i/base) )
eval( "total = Hex[" + ( i % base) + "] + total + ''")
return ( dec > 15 ) ? total : ( "0" + total)
}
var step=1
var turn=0
var id
function ccbg(){
turn = ( turn + step ) % 3600
window.status=turn
document.bgColor= ( toHex( ( 255 * Math.abs( Math.sin( toRadian((turn*1.1)) ) ) ) ) ) +
( toHex( (255 * Math.abs( Math.sin( toRadian((turn*1.9)) ) ) ) ) ) +
( toHex( (255 * Math.abs( Math.sin( toRadian((turn*1.5)) ) ) ) ) )
id=setTimeout("ccbg()",25)
}

//-->
</SCRIPT>


Paste the following code after the <BODY> tag.

<p>
<CENTER>
<H2>Script by Isaac Chau</H2>
<FORM>
click the button below to start:<BR>
<input type=button name="START" value="START" onClick="ccbg()"><P> click the botton below to stop:<BR> <input type=button name="STOP" value="STOP" onClick="clearTimeout(id) "> </FORM> </CENTER>



Some Notes






Just copy and paste the code to your HTML document.

Have fun !!

[Back To Geocities] [Back To ResearchTriangle]