if (document.all){pics=new Array("image/phone/iphone.png", "image/phone/bb.png", "image/phone/nokia.png", "image/phone/htcw.png", "image/phone/htca.png")//Transition speed. 4000 = 4 seconds etc.
delay=3000;//Nothing needs altering paste here.
l=new Array()
for (i=0; i < pics.length; i++){
l[i]=new Image()
l[i].src=pics[i]
}
n="progid:DXImageTransform.Microsoft.";
f=new Array()
f[0]="Wheel(spokes=4)";
f[1]="Blinds(Bands=10,direction=up)";
f[2]="Stretch(stretchstyle=PUSH)";
f[3]="Stretch(stretchstyle=SPIN)";
f[4]="RadialWipe(wipestyle=RADIAL)";
f[5]="RadialWipe(wipestyle=WEDGE)";
f[6]="Checkerboard(Direction=right,SquaresX=8,SquaresY=8)";
f[7]="Fade(Overlap=1.00)";
f[8]="GradientWipe(GradientSize=0.25,wipestyle=0,motion=forward)";
f[9]="Iris(irisstyle=CIRCLE,motion=out)";
f[10]="Iris(irisstyle=STAR,motion=out)";
f[11]="Barn(motion=out,orientation=vertical)";
f[12]="Barn(motion=in,orientation=vertical)";
f[13]="Strips(motion=leftup)";
f[14]="Slide(slidestyle=HIDE,Bands=1)";
f[15]="Slide(slidestyle=PUSH,Bands=1)";
f[16]="Slide(slidestyle=SWAP,Bands=1)";
f[17]="RandomDissolve(duration=1)";imgstep=0;function ani(){
rnd=f[Math.floor(Math.random()*f.length)]
box.style.filter=n+rnd;
box.filters[0].apply();
box.src=l[imgstep].src;
box.filters[0].play();
imgstep++;
if (imgstep >= l.length) imgstep=0;
setTimeout("ani()",delay);
}
window.onload=new Function("setTimeout('ani()',delay)")
}
公司搞网站的时候弄了这么一个用JS来实现图片变换的代码,在IE测试的时候一切正常,图片可以切换,换到Firefox的时候就只能显示第一张定义的图片,不能变换图片了。
JS以前也不怎么懂,入门级别都算不上,只知道应该是由于IE和Firefox对JS的不同兼容性引起的,希望高手解答,该怎么改代码使得Firefox也正常显示。