他是用javascript语言实现该功能的。具体代码如下:
<script language=javascript>
isns = navigator.appName == "Netscape";
function ztstr(id,picurl,linkurl)
{
this.id=id
this.picurl=picurl
this.linkurl=linkurl
}
zhuanti=new Array()
imgcount=1;
frequency=10*1000;//30秒
//在这里修改图片的路径和链接
zhuanti[1]=new ztstr('1','http://www.paradisewarner.com/upload/978732001115519617.jpg','http://www.paradisewarner.com');
zhuanti[2]=new ztstr('2','http://www.paradisewarner.com/upload/680688001117425821.jpg','http://www.paradisewarner.com');
zhuanti[3]=new ztstr('3','http://www.paradisewarner.com/upload/775387001117425845.jpg','http://www.paradisewarner.com');
zhuanti[4]=new ztstr('4','http://www.paradisewarner.com/upload/695105001117425915.jpg','http://www.paradisewarner.com');
zhuanti[5]=new ztstr('5','http://www.paradisewarner.com/upload/762497001117426037.jpg','http://www.paradisewarner.com');
zhuanti[6]=new ztstr('6','http://www.paradisewarner.com/upload/035557001118913628.jpg','http://www.paradisewarner.com');
zhuanti[7]=new ztstr('7','http://www.paradisewarner.com/upload/276436001118913702.jpg','http://www.paradisewarner.com');
zhuanti[8]=new ztstr('8','http://www.paradisewarner.com/upload/019603001118913740.jpg','http://www.paradisewarner.com');
//zhuanti[1]=new ztstr('1','http://www.paradisewarner.com/images/2004-9A.JPG','http://www.paradisewarner.com')
//zhuanti[2]=new ztstr('2','http://www.paradisewarner.com/images/2004-9B.JPG','http://www.paradisewarner.com')
//zhuanti[3]=new ztstr('3','http://www.paradisewarner.com/images/2004-9C.JPG','http://www.paradisewarner.com')
//zhuanti[4]=new ztstr('4','http://www.paradisewarner.com/images/2004-9D.JPG','http://www.paradisewarner.com')
//zhuanti[5]=new ztstr('5','http://www.paradisewarner.com/images/2004-8A.JPG','http://www.paradisewarner.com')
imgcount=zhuanti.length-1
for(i=1;i<=imgcount;i++)
{
eval("img"+i+"=new Image()"
eval("img"+i+".src=zhuanti["+i+"].picurl"
}
nn=1
var rand1 = 0;
var useRand = 0;
function swapPic() {
var imgnum = zhuanti.length - 1;
do {
var randnum = Math.random();
rand1 = Math.round((imgnum - 1) * randnum) + 1;
} while (rand1 == useRand);
useRand = rand1;
// alert(useRand);
nn=useRand;
change_img();
}
function change_img()
{
eval('document.pic.src=img'+nn+'.src');
nn++;
if(nn>imgcount) nn=1
if(!isns)
{
pic.filters.item(0).apply()
pic.style.visibility='visible'
pic.filters.item(0).play()
setTimeout("pic.style.visibility='hidden'",frequency);
}
else
document.pic.visibility='visible'
tt=setTimeout('change_img()',frequency)
}
function pictarget()
{
tt=nn-1
if(tt<1) tt=imgcount
cururl=zhuanti[tt].linkurl
window.open(cururl);
}
function ini()
{
if(!isns)
{
spacewidth=Math.round((divmask.offsetWidth-770)/2)
dmwidth=770+spacewidth
dmheight=divmask.offsetHeight
totalstep=50
timeout=50
dmstepw=Math.round(770/totalstep)
dmsteph=Math.round(dmheight/totalstep)
setTimeout('hidimg()',3000)
}
else swapPic()
}
function hidimg()
{
dmwidth-=dmstepw
dmheight-=dmsteph
eval('divmask.style.clip="rect(0,'+dmwidth+','+dmheight+',0)"')
hdrun=setTimeout('hidimg()',timeout)
if(dmwidth<=spacewidth&&dmheight<=0)
{
divmask.style.visibility='hidden'
clearTimeout(hdrun)
swapPic()
}
}
</script>