Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to fade in text

Status
Not open for further replies.

pob327

Technical User
Jul 19, 2007
13
0
0
US
This one line script fades the background color of a page nicely.
Code:
for (i = 0; i < 256; i++)
{
document.bgColor = (i++) * 256 *256 + (i++) * 256;
}
But if I try to apply the same thing to the font color of an element with this code:
Code:
for (i = 0; i < 256; i++)
{
document.getElementById("three").style.color = (i++) * 256 *256 + (i++) * 256;
}
it no longer fades, it just jumps to the last color value.
Why does it behave differently in the second snippet and how can I fade the color of text ?
 
Hi

[ul]
[li]It is a bad idea to manually modify the loop control variable inside the instruction block. Although it is permitted in JavaScript, is not recommended.[/li]
[li]The color codes begin with sharp ( # ) character. Although the browsers are forced by the tight concurrency to forgive many negligence, is not recommended.[/li]
[/ul]

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top