[thelist] DOM compliant Color Fades

Timothy Martens timfm at hawaii.rr.com
Wed Mar 27 16:35:01 CST 2002


This fades an element from black to white or white to black...


var clr=255;		// initial value

function fadeIt() {
if(clr>0) {			// if not yet black
	clr-=5;		// increments to black

document.getElementById("idName").style.color="rgb("+clr+","+clr+","+clr
+")";
	setTimeout("fadeIt()",1);
	}
	else
	clr=255;		// reset value
}


How could I break out the "var clr" it's R G B components so as to be
able to actually fade COLORS?

working model at...
http://home.hawaii.rr.com/timfm/theList/fade_test.html

//t


<tip title="Practical HTML text styling" author="Timothy Martens">
Todd Fahrner gives "production grade advice" on using CSS in conjunction
with <small> and <big> tags to keep your text styling accessible:
http://style.cleverchimp.com/font_size/livetext.html
</tip>




More information about the thelist mailing list