亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Javascript實(shí)現(xiàn)滾動(dòng)圖片新聞的實(shí)例代碼

 更新時(shí)間:2013年11月27日 10:05:02   作者:  
這篇文章主要介紹了Javascript實(shí)現(xiàn)滾動(dòng)圖片新聞的實(shí)例代碼。需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助

下面這段代碼是用來(lái)實(shí)現(xiàn)圖片新聞的

復(fù)制代碼 代碼如下:

var index = 0;
var Timer = null;

function initGallery(){
    for(var i=0; i< 4; i++){
       document.getElementById("fPic"+i).style.display = "none";
       document.getElementById("fTitl"+i).style.display = "none";
       document.getElementById("fNum"+i).style.className = "numOff";
    }
    startChange();
    setTimer();
}

function startChange(){
    index = index % 4;

    changePic(index);
    changeTitl(index);
    changeNum(index);

    index++;
}

function changePic(index){
    for(var i=0; i<4;i++){
        document.getElementById("fPic"+i).style.display = "none";
    }
    document.getElementById("fPic"+index).style.display = "block";
}

function changeTitl(index){
    for(var i=0; i<4; i++){
        document.getElementById("fTitl"+i).style.display = "none";
    }
    document.getElementById("fTitl"+index).style.display = "block";
}

function changeNum(index){
    for(var i=0; i<4; i++){
        document.getElementById("fNum"+i).className = "numOff";
    }
    document.getElementById("fNum"+index).className = "numOff numOn";
}

function clearTimer(){
    this.clearInterval(Timer);
}

function setTimer(){
    Timer = window.setInterval(startChange, 3000)
}

function setIndex(index){
    this.index = index;
    this.startChange();
}

相關(guān)文章

最新評(píng)論