Мигающий текст
<html>
<head>
<script>
var sR = 1;
var sG = 7;
var sB = 0;
var R = 255;
var G = 255;
var B = 255;
var b = true;
function h(color)
{
hn = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A" ,"B", "C", "D", "E", "F")
if (color < 0)
{return "00"}
else if (color > 255) {return "FF"}
else
{
s = "" + hn[Math.floor(color/16)] + hn[color%16]
return s
}
}
function toH(red, green, blue) {return h(red) + h(green) + h(blue)}
function RGB(red, green, blue) {return toH(red, green, blue)}
function setButtonColor(r, g, b) {document.all["button"].style.color = RGB(r, g, b)}
function startChanging()
{
if(b == true)
{
if((R > 256)||(G > 256)||(B > 256))
{
b = false;
}
R += sR; G += sG; B += sB;
}
else
{
if((R < 0) || (G < 0) || (B < 0))
{
b = true;
}
R -= sR; G -= sG; B -= sB;
}
setButtonColor(R, G, B);
setTimeout("startChanging()", 1)
}
</script>
</head>
<body onload="startChanging()">
<a name=button>Мигающий текст</a>
</body>
</html>
Вот как он работает:
Мигающий текст