50 lines
819 B
HTML
50 lines
819 B
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3c.org/1999/xhtml" xml:lang="da">
|
|
<head>
|
|
<title>ColorChange</title>
|
|
<script type='text/javascript'>
|
|
r=255
|
|
g=0
|
|
b=0
|
|
c=false
|
|
|
|
function loadit() {
|
|
document.body.style.backgroundColor="rgb("+r+","+g+","+b+")"
|
|
|
|
if (r==255 && g<255 && b==0)
|
|
g=g+1
|
|
else if (r>0 && g==255 && b==0)
|
|
r=r-1
|
|
else if (r==0 && g==255 & b<255)
|
|
b=b+1
|
|
else if (r==0 && g>0 && b==255)
|
|
g=g-1
|
|
else if (r<255 && g==0 && b==255)
|
|
r=r+1
|
|
else if (r==255 && g==0 && b>0)
|
|
b=b-1
|
|
|
|
t=setTimeout("loadit()",1)
|
|
}
|
|
|
|
function ccc() {
|
|
if (c==false) {
|
|
clearTimeout(t)
|
|
c=true
|
|
}
|
|
else
|
|
{
|
|
loadit()
|
|
c=false
|
|
}
|
|
}
|
|
|
|
window.onload=loadit
|
|
document.onclick=ccc
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
</body>
|
|
</html> |