图片切换代码

作者在 2007-05-09 01:22:00 发布以下内容

把下面整段插入页面
打了******的地方写图片地址,图片多的话多弄几个就可以了

<table width="535" height="215" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="450" height="215">< language=Java>
<!-- // BannerAD

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

bannerAD[0]="******.JPG";
bannerADlink[0]="******.JPG";
bannerAD[1]="******.JPG";
bannerADlink[1]="******.JPG";
bannerAD[2]="******.JPG";
bannerADlink[2]="******.jpg"

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

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

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

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

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

//-->
</>

<img
style="FILTER: revealTrans(duration=2,transition=20)" height=180
src="" width=180 border=1
name=bannerADrotator>
< language=Java>nextAd()</></td>
</tr>
</table>

 

 

 

 

 

 

 

 

 

你上面的代码乱了,我帮你写了个很简单的4个图片切换,你可以参考一下!
<div id="img1" style="display:none ">
<img src="1.jpg" border="0" width="480" height="450">
</div>
<div id="img2" style="display:none ">
<img src="2.jpg" border="0" width="383" height="278">
</div>
<div id="img3" style="display:none ">
<img src="3.jpg" border="0" width="383" height="278">
</div>
<div id="img4" style="display:none ">
<img src="4.jpg" border="0" width="383" height="278">
</div>

< language="java">
var len=4;
var times=500;
var thisis=0;

jpgto()
{
if(thisis>len){thisis=0;}
switch (thisis)
{
case 1:
img1.style.display="";
img2.style.display="none";
img3.style.display="none";
img4.style.display="none";
break;
case 2:
img1.style.display="none";
img2.style.display="";
img3.style.display="none";
img4.style.display="none";
break;
case 3:
img1.style.display="none";
img2.style.display="none";
img3.style.display="";
img4.style.display="none";
break ;
case 4:
img1.style.display="none";
img2.style.display="none";
img3.style.display="none";
img4.style.display="";
break;

}
thisis++;
}
var s=setInterval('jpgto()',times);
</>

ASP | 阅读 3215 次
文章评论,共0条
游客请输入验证码