本文实例讲述了js实现图片从左往右渐变切换效果的方法。分享给大家供大家参考。具体实现方法如下:
|
||||
<script><br /> var n=0;<br /> var showNum = document.getElementByIdx_x("num");<br /> function Mea(value){<br /> n=value;<br /> setBg(value);<br /> plays(value);<br /> }<br /> function setBg(value){<br /> for(var i=0;i<4;i++)<br /> if(value==i){<br /> showNum.getElementsByTagName_r("td")[i].className='woon';<br /> }<br /> else{<br /> showNum.getElementsByTagName_r("td")[i].className='wooff';<br /> } <br /> }<br /> function plays(value){<br /> with (fc){<br /> filters[0].Apply();<br /> for(i=0;i<4;i++)i==value?children[i].style.display="block":children[i].style.display="none";<br /> filters[0].play(); <br /> }<br /> }<br /> function clearAuto(){clearInterval(autoStart)}<br /> function setAuto(){autoStart=setInterval("auto(n)", 5000)}<br /> function auto(){<br /> n++;<br /> if(n>3)n=0;<br /> Mea(n);<br /> }<br /> function sub(){<br /> n--;<br /> if(n<0)n=3;<br /> Mea(n);<br /> }<br /> setAuto();<br /> </script> |