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); }
原文地址:https://www.cnblogs.com/xyzhuzhou/p/3754696.html