博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

js文字特效制作js文字闪烁与文字变色效果

Posted on 2013-05-21 09:02  人生梦想起飞  阅读(7542)  评论(1编辑  收藏  举报

<!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.jsfoot.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>