js实现(单个)图片定时闪烁变化(transition=1)
<html><head>
<title></title>
<script language="javascript">
<!--
//图片的变化有23种,这个页面先实现单个图片第1种transition变化;以后会提供1)多个图片,2)多种闪烁变化等网页效果,大家可以思考尝试自己编写。
function start()
{
obj=eval("img1");
obj.style.visibility="hidden";
obj.filters.item(0).Apply();
obj.style.visibility="visible";
obj.src="baby7.jpg"; //选择要加载的图片
obj.filters.item(0).Play();
start2();
}
function start3(obj2,str2)
{
if (document.all)
//测试eval(obj2+'.innerHTML = str2');
obj2.src="baby7.jpg";
}
var i=0;
function start2()
{
//obj2 = eval("tag1");
var str1="abcefghijklmnopqrstuvwxyz";
if (i<str1.length)
{
i++;
str2 = str1.substring(0,i); //可以用str1.slice(0,i);
start3('img1',"<font color='red'>" + str2 + "</font>");
setTimeout("start2()",500);
}
if (i==str1.length)
{
i=16; //调整可以调整图片变化的速度,数值在1-22为合适,变化太快会失灵或效果不实际
setTimeout("start1()",2000); //可以直接用start1();
}
}
function start1()
{
obj=eval("img1");
obj.style.visibility="hidden";
obj.filters.item(0).Apply();
obj.style.visibility="visible";
obj.src="baby7.jpg";
obj.filters.item(0).Play();
}
-->
</script>
</head>
<body onload=start()>
<div id="tag1">
<img id="img1" src="XXX.jpg" width="200" height="134" style="filter:revealTrans(Transition=1,Duration=1.5)" >
</div>
</body>
</html>