grobend
14 May 2011, 09:27 PM
Hi, I've been using the following code to give the text a fade-in effect when the page loads. Unfortunately, this code only works for texts. I want the same effect for hyperlinks and images. What do I need to do?
<html>
<head>
<script language="javascript">
col=255;
function fade() { document.getElementById("fade").style.color="rgb(" + col + "," + col + "," + col + ")"; col-=5; if(col>0) setTimeout('fade()', 10); }
</script>
</head>
<body onLoad="fade()">
<p>
<span id="fade">Fading text</span>
</p>
</body></html>
<html>
<head>
<script language="javascript">
col=255;
function fade() { document.getElementById("fade").style.color="rgb(" + col + "," + col + "," + col + ")"; col-=5; if(col>0) setTimeout('fade()', 10); }
</script>
</head>
<body onLoad="fade()">
<p>
<span id="fade">Fading text</span>
</p>
</body></html>