多张图片切换javascript例子

本文介绍了一个使用JavaScript实现的简单图片轮播示例。该示例通过预设的时间间隔自动切换图片,并可以随机选择不同的过渡效果。但不支持手动选择特定图片进行展示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转载自:http://apps.hi.baidu.com/share/detail/5472492

多张图片切换javascript例子,可以选择切换的样式,不过不能选择指定的图片

<table width="535" height="215" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="450" height="215"> <mce:script language=JavaScript><!-- //js代码 var bannerAD=new Array(); //用于存放图片路径(相对路径) var adNum=0; bannerAD[0]="images/mibao.jpg"; bannerAD[1]="images/IMG_0882.JPG"; bannerAD[2]="images/IMG_0883.JPG"; bannerAD[3]="images/IMG_0884.JPG"; 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); //5秒钟切换一张图片 } // --></mce:script> <img style="FILTER: revealTrans(duration=2,transition=20)" mce_style="FILTER: revealTrans(duration=2,transition=20)" height=292 src="" width=515 border=1 name=bannerADrotator> <SCRIPT language=JavaScript>nextAd()</SCRIPT> </td> </tr> </table>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值