Hi,
I know, this is not the correct forum to post this....But, still, i am using this in my JSP page and this is also JavaScript....so, please excuse.
I have a requirement to fade in and out, the given text. First text should start from light color (say white) to dark black. After that, it should fade off (say from dark black to white)...I could do only the first part....(from white to black.)...how to do viz..??
please help! My code as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Scrolling news </TITLE>
<script language="JavaScript">
hex=255 // Initial color value.
function fadetext()
{
if(hex>0)
{ //If color is not black yet
hex-=11; // increase color darkness
document.getElementById("sample").style.color="rgb("+hex+","+hex+","+hex+")";
setTimeout("fadetext()",100);
}
else
hex=255 //reset hex value
}
</script>
<div id="sample" style="width:100%"><h3>Click on the Divisions on your Left hand Side</h3></div>
<!--<button onClick="fadetext()">Fade Text</button>-->
</HEAD>
<BODY onLoad="fadetext()">
<h4>Hello World</h4>
<img src="hightech.jpg">
</BODY>
</HTML>