图片随机切换特效

这是图片随机切换特效,共四张图片

 
   
 

 

1.在<head>区域插入以下代码

<script language=JavaScript>
<!-- // BannerAD

var bannerAD=new Array();
var bannerADlink=new Array();
var adNum=0;

bannerAD[0]="images/xxlha/DSC00393.JPG";
bannerADlink[0]="images/xxlha/DSC00393.JPG";
bannerAD[1]="images/xxlha/DSC00703.JPG";
bannerADlink[1]="images/xxlha/DSC00703.JPG";
bannerAD[2]="images/xxlha/DSC00228.JPG";
bannerADlink[2]="images/xxlha/DSC00228.JPG";
bannerAD[3]="images/xxlha/DSC00393.JPG";
bannerADlink[3]="images/xxlha/DSC00393.JPG";
bannerAD[4]="images/xxlha/DSC00372.JPG";
bannerADlink[4]="images/xxlha/DSC00372.JPG";
var preloadedimages=new Array();

for (i=1;i<bannerAD.length;i++){
preloadedimages[i]=new Image();
preloadedimages[i].src=bannerAD[i];
}

function setTransition(){
if (document.all){
bannerADrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);
bannerADrotator.filters.revealTrans.apply();
}
}

function playTransition(){
if (document.all)
bannerADrotator.filters.revealTrans.play()
}

function nextAd(){
if(adNum<bannerAD.length-1)adNum++ ;
else adNum=0;
setTransition();
document.images.bannerADrotator.src=bannerAD[adNum];
playTransition();
theTimer=setTimeout("nextAd()", 5000);
}

function jump2url(){
jumpUrl=bannerADlink[adNum];
jumpTarget='_blank';
if (jumpUrl != ''){
if (jumpTarget != '')window.open(jumpUrl,jumpTarget);
else location.href=jumpUrl;
}
}
function displayStatusMsg() {
status=bannerADlink[adNum];
document.returnValue = true;
}

//-->
</script>

2.把以下代码插入表格

<td><A onmouseover="displayStatusMsg();return document.returnValue" href="javascript:jump2url()"><IMG src="images/xxlha/DSC00393.JPG" name=bannerADrotator width=550 height=412 border=0 align="absmiddle" style="FILTER: revealTrans(duration=2,transition=20)";></A>
<SCRIPT language=JavaScript>nextAd()</SCRIPT></td>

3.红字可以替换自己的图片地址和尺寸

                                                   2006年3月26日

 

返回主页