<span id="theText" style="width:100%">
<h1>荧 光 效 果 例 子</h1>
</span>
<script>
<!--
var from = 1;
var to = 4;
var delay = 55; //闪的速度
var glowColor = "lime";//颜色
var i = to;
var j = 0;
textPulseDown();
function textPulseUp()
{
if (!document.all)
return
if (i < to)
{
theText.style.filter = "Glow(Color=" + glowColor + ", Strength=" + i + ")";
i++;
theTimeout = setTimeout('textPulseUp()',delay);
return 0;
}
if (i = to)
{
theTimeout = setTimeout('textPulseDown()',delay);
return 0;
}
}
function textPulseDown()
{
if (!document.all)
return
if (i > from)
{
theText.style.filter = "Glow(Color=" + glowColor + ", Strength=" + i + ")";
i--;
theTimeout = setTimeout('textPulseDown()',delay);
return 0;
}
if (i = from)
{
theTimeout = setTimeout('textPulseUp()',delay);
return 0;
}
}
//-->
</script>
该博客展示了使用JavaScript实现荧光效果的示例代码。代码中设置了闪烁速度、颜色等参数,通过textPulseUp和textPulseDown两个函数控制荧光强度的变化,利用setTimeout函数实现延迟效果。
347

被折叠的 条评论
为什么被折叠?



