Task: Fade from old colour to new colour

All of the calculations and conversions up to this point have occured in decimal notation. JavaScript's standard operators can't operate on hexidecimal numbers, and even if they could, hexidecimal operations would be more difficult to code. However, to use the values in conjuction with the bgColor property, each individual value must be converted back into hexidecimal notation.

After the conversion has been made, each value can then be assigned to the document.bgColor property. To achieve the fade effect, these two steps will be encapsulated in a for loop.

Close window