...

View Full Version : bgcollor change



Kura_kai
07-04-2005, 08:40 PM
I need help in making a function that changes the collor that is stored in a array where each slot is either 0-9 or A-F and it will compine them to make the collor thingy. But i want it when it is done increase the last one by 1 and update all the rest. so that the collor stays the same if someone can post a sample script for me to work from will be fine

asdruble
07-04-2005, 09:17 PM
i dont really get what u mean...

rlemon
07-05-2005, 12:22 AM
is that even english? :confused:

Kura_kai
07-05-2005, 12:31 AM
ok i want to make a script that changes the back ground collor from white to black and every collor inbetween. So in the end the first collor it changes it to is #000000 and than goes to #FFFFFF and after that goes back to white. so somehow it should do something like this
#000000
#000001
#000002
#000003
etc.
But once it gets to #FFFFFF it sets it back down to #000000. Does that help?

Kura_kai
07-05-2005, 12:33 AM
and i do believe i have been spelling collor wrong but not sure

coothead
07-05-2005, 11:59 AM
Hi there Kura_kai,

try this, it may give you some ideas...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>background color change</title>

<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
<meta name="Content-Script-Type" content="text/javascript"/>
<meta name="Content-Style-Type" content="text/css"/>
<style type="text/css">
/*<![CDATA[*/

body {
background-color:#999;
}
#foo {
width:324px;
height:200px;
border:6px inset #999;
margin:50px auto;
}

/*//]]>*/
</style>

<script type="text/javascript">
//<![CDATA[

var i=0;
var j=0;
var k=0;

function stuffup() {
document.getElementById('foo').style.backgroundColor='rgb('+i+','+k+','+j+')';
i++;
if(i>=255) {
j++;
}
if(j>=255) {
k++;
}
if(k==255) {
i=255;
j=255;
clearTimeout(up);
stuffdown();
return;
}
up=setTimeout('stuffup()',20);
}

function stuffdown() {
document.getElementById('foo').style.backgroundColor='rgb('+i+','+k+','+j+')';
k--;
if(k<=0) {
j--;
}
if(j<=0) {
i--;
}
if(i==0) {
j=0;
k=0;
clearTimeout(down);
stuffup();
return;
}
down=setTimeout('stuffdown()',20);
}
onload=stuffup;

//]]>
</script>

</head>
<body>

<div id="foo"></div>

</body>
</html>


coothead

Kura_kai
07-05-2005, 06:27 PM
That code is very nice but unfortunatly i don't know how it works :( and trying to decipher it also...any help with that? :confused:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum