• javascript 图片切换


    <SCRIPT language=JavaScript> 
    <!-- // BannerAD 
          
    var bannerAD=new Array(); 
    var bannerADlink=new Array(); 
    var adNum=0; 
          
    bannerAD[0]="indexbanner/1.jpg"; 
    bannerADlink[0]="#"; 
    bannerAD[1]="indexbanner/2.jpg"; 
    bannerADlink[1]="#"; 
    bannerAD[2]="indexbanner/3.jpg"; 
    bannerADlink[2]="#"; 
    bannerAD[3]="indexbanner/4.jpg"; 
    bannerADlink[3]="#"; 
    bannerAD[4]="indexbanner/5.jpg"; 
    bannerADlink[4]="#"; 
    bannerAD[5]="indexbanner/6.jpg"; 
    bannerADlink[5]="#"; 
    bannerAD[6]="indexbanner/7.jpg"; 
    bannerADlink[6]="#"; 
    bannerAD[7]="indexbanner/8.jpg"; 
    bannerADlink[7]="#"; 
          
    var preloadedimages=new Array(); 
    for (i=0;i<bannerAD.length;i++){ 
    preloadedimages=new Image(); 
    preloadedimages.src=bannerAD; 

          
    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()", 3500); 

          
    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>
                <A onmouseover="displayStatusMsg();return document.returnValue" 
                href=""><IMG 
                style="FILTER: revealTrans(duration=2,transition=23)" 
                src="TungstenCore.files/1.jpg" border=0 name=bannerADrotator> </A>
                <SCRIPT language=JavaScript>nextAd()</SCRIPT>

    (2)
    <script language=JavaScript>
    var imgUrl=new Array();
    var imgLink=new Array();
    var adNum=0;
    imgUrl[1]="/images/qhdbanner1.gif"; 
    imgLink[1]=""; 
    imgUrl[2]="/images/qhdbanner2.gif"; 
    imgLink[2]=""; 


         var imgPre=new Array();
       for (i=1;i<3;i++){
    imgPre=new Image();
          imgPre.src=imgUrl;
       }


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

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


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

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

    暂停之后调用

    <script language="javascript">
            function Pause(obj, iMinSecond) {
                if (window.eventList == null) window.eventList = new Array();
                var ind = -1;
                for (var i = 0; i < window.eventList.length; i++) {
                    if (window.eventList[i] == null) {
                        window.eventList[i] = obj;
                        ind = i;
                        break;
                    }
                }

                if (ind == -1) {
                    ind = window.eventList.length;
                    window.eventList[ind] = obj;
                }
                setTimeout("GoOn(" + ind + ")", iMinSecond);
            }


            function GoOn(ind) {
                var obj = window.eventList[ind];
                window.eventList[ind] = null;
                if (obj.NextStep) obj.NextStep();
                else obj();
            }

            function Start() {
                Pause(this, 10000); //调用暂停函数
                this.NextStep = function() {
                    nextAd();
                }
            } 
        </script>

  • 相关阅读:
    阿里面试后的问题总结
    Spring IOC源码实现流程
    Spring Aop源码分析
    SpringCloud的分布式配置及消息总线
    阿里java编码规范考试总结
    压缩文件的压缩时候中文乱码码
    mybatis的时间比较 xml 及不解析<=的写法
    批量插入一张表的数据,并且生成不同的uuid 字符截取 批量更新 去除重复数据
    Redis集群的搭建
    Python 之 基础知识(二)
  • 原文地址:https://www.cnblogs.com/zwei1121/p/1796401.html
Copyright © 2020-2023  润新知