日期:2014-05-17  浏览次数:20576 次

在页面同一位置轮番播放图片?
如题,怎么实现?

------解决方案--------------------
JScript code

<script type=text/javascript>
                <!--
                //var nPic = new Array(),nPiclink=new Array(),nPicTit=new Array(),preloadedimages=new Array();
                var nPic = new Array(),nPiclink=new Array(),preloadedimages=new Array();
                var nPicNum=0;
                nPic[0]="../nntcn_image/pic/shua1.gif";
                nPiclink[0]="#";
            
        preloadedimages[1]=new Image();
                preloadedimages[1].src=nPic[0];//Modify2008-03-28 Author:xinghai.li
                nPic[1]="../nntcn_image/pic/gg200809.gif";
                nPiclink[1]="#";
        preloadedimages[2]=new Image();
                preloadedimages[2].src=nPic[1];//Modify2008-03-28 Author:xinghai.li
                nPic[2]="../nntcn_image/pic/gg3.gif";
                nPiclink[2]="#";
                preloadedimages[3]=new Image();
                preloadedimages[3].src=nPic[2];//Modify2008-03-28 Author:xinghai.li
                nPic[3]="../nntcn_image/pic/gg2.gif";
                nPiclink[3]="#";

                function setTransition(){
                    if(document.all) {
                        document.getElementById('nPicRotator').filters.revealTrans.Transition=23;
                        document.getElementById('nPicRotator').filters.revealTrans.apply();
                    }
                }
                function playTransition(){
                    if(document.all){
                        //alert("nPicRotator" + document.getElementById('nPicRotator'));
                        document.getElementById('nPicRotator').filters.revealTrans.play();
                    }
                }
                function nextAd(){
                    if(nPicNum < nPic.length-1){
                        nPicNum++;
                    } else {
                        nPicNum=0;
                    }
                    midWay();
                    theTimer=setTimeout("nextAd()",4000);
                }
                function midWay(){
                setTransition();
                document.getElementById('nPicRotator').src=nPic[nPicNum];
                document.getElementById('nPicRotatorA').href=nPiclink[nPicNum];
                
                playTransition();
                }
                theTimer=setTimeout("nextAd()",4000);
                //-->
                </script>