js实现图片循环播放

脚本
<script type="text/javascript"> 
<!--
var bannerAD=new Array();
var bannerADlink=new Array();
var adNum=0;


bannerAD[0]="dh.gif";
bannerADlink[0]="index.htm"

bannerAD[1]="dh2.gif";
bannerADlink[1]="index.htm"


/*图片可以增加*/
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()", 4000);
}

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>


表现
<table width="240" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> 
<tr>
<td width="236" height="150" bgcolor="#FFFFFF"><a onmouseover="displayStatusMsg();return document.returnValue" href="javascript:jump2url()"><img src="dh2.gif" name="bannerADrotator" width="240" height="160" border="0" align="middle" id="bannerADrotator"
style="FILTER: revealTrans(duration=2,transition=40)" /></a>
<script type="text/javascript">nextAd()</script></td>
</tr>
</table>
阅读更多
文章标签: Java 脚本
个人分类: js
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭