一来学校就给外联办的网站改版,我把其中一个JS轮播代码分享给大家,大家只需把里面图片的绝对地址更改一下就可以了!

<SCRIPT language=Javascript>  
var bannerAD=new Array();
var bannerADlink=new Array();
var adNum=100;
bannerAD[0]=’/lbimages/1.jpg’;
bannerADlink[0]=’/index.asp’;
bannerAD[1]=’/lbimages/2.jpg’;
bannerADlink[1]=’/index.asp’;
bannerAD[2]=’/lbimages/3.jpg’;
bannerADlink[2]=’/index.asp’;
bannerAD[3]=’/lbimages/4.jpg’;
bannerADlink[3]=’/index.asp’;
bannerAD[4]=’/lbimages/5.jpg’;
bannerADlink[4]=’/index.asp’;
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>
              <img alt=”嘉实太中心项目介绍” name=bannerADrotator width=”100%” height=”100%” border=0 align=center style=”FILTER: revealTrans(duration=2,transition=20)”>
              <SCRIPT language=JavaScript>nextAd()</SCRIPT>

今天分享一下JS图片轮播代码

发表评论

电子邮件地址不会被公开。 必填项已用*标注