js元素闪动效果

<img src="http://yjy.allbring.com/UpLoadFiles/head/p1_20140326104945_17-10164142709.jpg"  style=" position:relative;"  id="aa" />



function
setAnimation() { var attr = ["top", "left"], b = 0; u = setInterval(function () { document.getElementById("aa").style[attr[b % 2]] = (b++) % 4 < 2 ? 0 : 4; //alert(document.getElementById("aa").tagName); b++; if (b > 30) { clearInterval(u); b = 0; setAnimation(); } }, 32); }

 

posted @ 2014-05-27 11:06  xyzhuzhou  阅读(650)  评论(0编辑  收藏  举报