快捷导航

图片轮播js一直报错

function byId(id){        return typeof(id)==="string"?document.getElementById("id"):(id);}var index=0,        pics=byId("banner").getElementsByTagName("div"),        len=pics.length,        timer=null,function slideImg(){        //鼠标离开,进行轮播        var main=byId("main");        main.onmouseout=function(){                timer=setInterval(function(){                        index++;                        if(index>=len){                                index=0;                        }                        //图片切换                        changeImg();                },3000)        }        main.onmouseout();}function changeImg(){        //鼠标离开时,给索引添加display属性        pics[index].style.display="block";}js没写完但是function slideImg(){这一行一直报错,html在下方
9.20





css在这里
*{        padding: 0;        margin:0;}ul{        list-style: none;}body{        font-family: "微软雅黑";        font-size: 14px;}a{        text-decoration:none;}/*轮播图*/.banner{        width: 1200px;        height: 460px;        position: absolute;        top:50%;        left:50%;        margin-top: -230px;        margin-left: -600px;        overflow: hidden;}.banner-slide{        width: 1200px;        height:460px;        display: none;}.slide1{        background-image: url("../img/1.jpg");}.slide2{        background-image: url("../img/3.jpg");}.slide3{        background-image: url("../img/4.jpg");}.slide4{        background-image: url("../img/5.jpg");}.slide-active{        display: block;}求大神来看看吧

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP