最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

肯求各路神仙为什么鼠标滑过不变色呀~_html/css_WEB-ITnose

来源:动视网 责编:小采 时间:2020-11-27 15:50:50
文档

肯求各路神仙为什么鼠标滑过不变色呀~_html/css_WEB-ITnose

肯求各路神仙为什么鼠标滑过不变色呀~_html/css_WEB-ITnose:html代码: window.onload=function(){ var arr1=document.getElementById(ch_tab).getElementsByTagName(li); var arr2=document.getElementById(ch_tab_content); arr3=geti
推荐度:
导读肯求各路神仙为什么鼠标滑过不变色呀~_html/css_WEB-ITnose:html代码: window.onload=function(){ var arr1=document.getElementById(ch_tab).getElementsByTagName(li); var arr2=document.getElementById(ch_tab_content); arr3=geti


html代码:





window.onload=function(){
var arr1=document.getElementById("ch_tab").getElementsByTagName("li");
var arr2=document.getElementById("ch_tab_content");
arr3=getids(arr2,"tab_contents","div");

for(i=0;i arr1[i].index=i;
arr1[i].onmouseover=function(){
for(i=0;i arr1[i].className="";
arr3[i].style.display="none";
}
arr3[this.index].style.display="block";
this.className="active";

}
}
function getids(a,b,c){
var arr1=a.getElementsByTagName("div");
var arr=[];
for(i=0;i if(arr1[i].className==b){
arr.push(arr1[i]); //把选出来的对象放在数组中
}
}
return arr;
}
}










  • aaaa

  • bbbb

  • cccc

  • dddd





  • 1111
    2222
    3333
    4444







    CSS代码:

    .tab_main{
    width:600px;
    height:400px;
    border:1px solid gray;
    }
    /*tab标签*/
    #ch_tab{


    }
    .ch_ul_tab{
    width:560px;
    height:26px;
    border-bottom:1px solid gray;
    }
    .ch_ul_tab li{
    width:70px;
    height:25px;
    float:left;
    list-style:none;
    margin-left:20px;
    text-align:center;
    background:green;
    border-top:1px solid gray;
    border-left:1px solid gray;
    border-right:1px solid gray;

    }
    /*tab标签内容*/
    #ch_tab_content{
    clear:both;
    width:600px;
    height:364px;

    }
    .active{
    background:yellow;
    border-bottom:1px solid white;
    }


    回复讨论(解决方案)

    我想把TAB标签的绿色变成黄色呀

    在这个样式中:
    .ch_ul_tab li{
    width:70px;
    height:25px;
    float:left;
    list-style:none;
    margin-left:20px;
    text-align:center;
    background:green;
    border-top:1px solid gray;
    border-left:1px solid gray;
    border-right:1px solid gray;

    }
    把background:green;去掉, 可以简单的换色(好象就是在上面的样式中加了一句background:yellow;) 但逻辑不对呀!

    .ch_ul_tab li.active{
    background:yellow;
    border-bottom:1px solid white;
    }

    .ch_ul_tab li.active{
    background:yellow;
    border-bottom:1px solid white;
    }
    ++
    正解.

    文档

    肯求各路神仙为什么鼠标滑过不变色呀~_html/css_WEB-ITnose

    肯求各路神仙为什么鼠标滑过不变色呀~_html/css_WEB-ITnose:html代码: window.onload=function(){ var arr1=document.getElementById(ch_tab).getElementsByTagName(li); var arr2=document.getElementById(ch_tab_content); arr3=geti
    推荐度:
    标签: 为什么 变色 鼠标
    • 热门焦点

    最新推荐

    猜你喜欢

    热门推荐

    专题
    Top