在线
客服

发布
需求

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

我刚刚看课程写了一段tab选项卡的代码,但是点击没效果,咋办?

求助
下面是源代码,求各位大佬帮忙解决css        *{margin:0;padding:0;font-family:微软雅黑;}        a,img{border:none;text-decoration:none;}        ul,li{list-style-type:none;}        #nav{width:1180px;overflow:hidden;margin:50px auto 0 auto;padding:0 10px;background-color:#f3f3f3;}        .tab_li{float:left;line-height:50px;width:125px;}        .tab_li a{display:block;text-align:center;font-size:16px;color:#333;}        .tab_li:hover{background-color:#ddd;}        #xinwen{width:1180px;overflow:hidden;margin:0 auto;height:450px;padding:0 10px;background-color:#fcfcfc;position:relative;}        .tab_div{display:none;width:1180px;background-color:#fcfcfc;height:450px;line-height:450px;text-align:center;font-size:72px;color:#ccc;position:absolute;top:0;left:0;}                js        window.onload=function(){                var oBdTab = document.getElementsByClassName("tab_div")[1];                var oTab = document.getElementsByClassName("tab_div");                var oLi = document.getElementsByClassName("tab_li")[1];                var ali = document.getElementsByClassName("tab_li");                oBdTab.style.display = 'block';                oLi.style.backgroundColor = '#ddd';                oLi.style.fontWeight = 'bold';                for(var i = 0;i < ali.length; i++){                        ali.index = i;                        ali.onclick = function(){                                for(var i = 0;i < oTab.length; i++){                                        ali.style.backgroundColor = '';                                        ali.style.fontWeight = '';                                        oTab.style.display = '';                                }                                ali[this.index].style.backgroundColor = '#ddd';                                ali[this.index].style.fontWeight = 'bold';                                oTab[this.index].style.display = 'block';                        }                }        }                html                       
                           
  • 热点                       
  • 今日推荐                       
  • 直播                       
  • 视频                       
  • 阅读               
       
                        热点
                今日推荐
                直播
                视频
                阅读

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

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

使用道具 举报

全部参与2

有个东西叫控制台,按F12出现,自己去看哪里报错

使用道具 举报

代码功能结构,语法没什么错,重新检查你的代码,应该是某个单词这不能,或者是符号缺余

使用道具 举报

发新帖
国内首家创新型IT技术需求众包服务平台,软件需求就上天盟网! 立即登录 立即注册