js文字颜色闪烁

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js文字特效制作js文字闪烁与文字变色效果</title>
<meta name="description" content="js文字特效制作一个js文字闪烁效果,文字间隙颜色变化红、黄、蓝闪烁过程。内含js代码下载。" />
</head>

<body>

<a id="actext" href="http://www.17sucai.com"><b>js文字颜色闪烁</b></a>

<script type="text/javascript">
var i = 0;
function getColor(){
    i++;
    switch(i){ 
        case 1:return "#ff0000";
        case 2:return "#ff6600";
        case 3:return "#3366cc";
        default:return "black";
    }
}
function colorful(){
    var o =document.getElementById('actext');
    o.style.color=getColor();
    if(i==3)i=0;
    setTimeout('colorful()',1000);
}
colorful();
</script>

</body>
</html>
原文地址:https://www.cnblogs.com/yy123/p/4234308.html