图片幻灯片切换效果js代码

有时候看到图片幻灯片切换效果非常好看,但是如果用flash实现的话固然简单,后期修改麻烦。所以如果能用js代码来实现的话岂不方便……

下面是程序代码:

<SCRIPT language=JavaScript>
var bannerph=new Array();
var bannerphlink=new Array();
//var links=new Array();
var phNum=0;
bannerph[1]="<#ZC_BLOG_HOST#>upload/201008131746368644.jpg";
bannerph[2]="<#ZC_BLOG_HOST#>upload/201008131747100444.jpg";

var prelophedimages=new Array();
for (i=0;i<bannerph.length;i++){
prelophedimages[i]=new Image();
prelophedimages[i].src=bannerph[i];}
function setTr(){
if (document.all){
document.images.bannerphrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);
document.images.bannerphrotator.filters.revealTrans.apply();
}
}
function playTr(){
if (document.all)
document.images.bannerphrotator.filters.revealTrans.play()
}
function nextph(){
if(phNum<bannerph.length-1)phNum++ ;
else phNum=0;
setTr();
document.images.bannerphrotator.src=bannerph[phNum];
//document.getElementById("a100000").href=links[phNum];
playTr();
theTimer=setTimeout("nextph()",5000);
}//-->

</SCRIPT>
<DIV id=a100000><IMG class=left
style="FILTER: revealTrans(duration=2,transition=20)" height=300
src="<#ZC_BLOG_HOST#>upload/201008131747100444.jpg"
width=480 border=0 name=bannerphrotator></DIV>
<DIV align=left>
<SCRIPT language=JavaScript>nextph()</SCRIPT>
</DIV>