テキストを白から黒にフェードインできる次のフェードコードがありますが、私のWebサイトにはバックグラウンドがあり、これを黒から白にフェードする必要があります..
<html>
<head>
<title>Fading Text Example</title>
<script language="javascript">
var hcolor=255;
function Fade(direction) {
obj=document.getElementById("head1");
hcolor += direction;
if (hcolor >= 0 && hcolor < 256) {
hex=hcolor.toString(16);
if (hex.length==1) hex="0" + hex;
obj.style.color="#" + hex + hex + hex;
window.setTimeout("Fade(" + direction + ");",1);
}
}
</script>
</head>
<body onLoad="Fade(1);">
<h1 ID="head1" style="color:#FFFFFF;">
Fading Text Example</h1>
</body>
</html>