用JS弄的二级导航没效果 求大神看看_html/css_WEB-ITnose

WBOY
Lepaskan: 2016-06-24 12:17:34
asal
943 orang telah melayarinya

HTML代码

<script></script> 

<script>var def=1;</script>

<script></script>






<script>bannerHover("menu-parent",0)</script>  



  

    
领先网站建设,SEO优化,网络推广,一站通式网络营销平台、完善的售后服务体系 ?? 武汉网站建设热线:027-68870209

    
    
    
    
    
    
    
  



<script></script>


-----------------------------------------------------------------------------------

css样式:
#nav {
width:100%;
height:71px;
font-size:12px;
background-image:url(images/nav.gif);
}

#nav_menu {
width:1003px;
height:36px;
padding-top:7px;
}

#menu_parent {
padding-left:124px;
height:36px;
font-size:12px;
}

#menu_parent li {
height:36px;
line-height:36px;
text-align:center;
float:left;
list-style:none;
}

#menu_parent .nav_li01 {
width:93px;
}

#nav ul .nav_li02 {
width:1px;
background:url(images/nav_gd_bg.gif) no-repeat;
}

.nav_li01 a:link, .nav_li01 a:visited {
color:#FFF;
text-decoration:none;
display:block;
}

.nav_li01 a:hover, .nav_li01 a:active {
color:#CCC;
text-decoration:none;
background:url(images/nav_hover.gif) no-repeat;
display:block;
}

.nav_li01hover {
width:93px;
height:36px;
line-height:36px;
text-align:center;
display:block;
background:url(../images/nav_hover.gif) no-repeat;
text-decoration:none;
}
.nav_li01hover a:link, .nav_li01hover a:visited {
color:#DDD;
text-decoration:none;
}

/*sub_nav start*/
#sub_nav {
width:100%;
height:28px;
clear:both;
}
#sub_box {
/* width:755px;*/
width:848px;
margin:auto;
height:28px;
padding-left:124px;
padding-right:124px;
}
#sub_box div {
height:28px;
line-height:28px;
color:#999999;
display:none;
}
#sub_box a {
color:#999999;
text-decoration:none;
}
#sub_box a:hover, #sub_box a:active {
color:#EC0000;
}
#son1 {
margin-left:24px;
}
#son2 {
margin-left:112px;
}
#son3 {
margin-left:205px;
}
#son4 {
margin-left:299px;
}
#son5 {
margin-left:395px;
}
#son6 {
margin-left:138px;
}
#son7 {
margin-left:570px;
}
#son8 {
margin-left:675px;
}
#son9 {
margin-left:730px;
}
/*sub_nav end*/
------------------------------------------------------------------------------------
common.js文件:
function ymshow(num)
{
document.getElementById("ymzc").style.display="none";
document.getElementById("ymys").style.display="none";
document.getElementById(num).style.display="block";
}
function bannerHover(name, now) {
    var thisul = document.getElementById(name);
    var thisli = thisul.getElementsByTagName("li");
    var thistotal = thisli.length;
    for (var i = 0; i          if (i == now) {
            thisli[i].className = "dhhover";
            thisli[i].onmouseout = function() {
            this.className = "dhhover";  
            }
        }
        else {
            thisli[i].className = "dhMove";
        }
    }
}
function meiti(num,str) {
    document.getElementById("mei01").style.display = "none";
    document.getElementById("mei02").style.display = "none";
    document.getElementById("MDesign").style.display = "none";
    document.getElementById("MInternet").style.display = "none";
    document.getElementById(num).style.display = "";
    document.getElementById(str).style.display = "";
}
function seoshow(num, str) {
    document.getElementById("baiduseo").style.display = "none";
    document.getElementById("gugeseo").style.display = "none";
    document.getElementById("baiducontent").style.display = "none";
    document.getElementById("gugecontent").style.display = "none";
    document.getElementById(num).style.display = "";
    document.getElementById(str).style.display = "";
}
function bannerHover(name, now) {
    var thisul = document.getElementById(name);
    var thisli = thisul.getElementsByTagName("li");
    var thistotal = thisli.length;
    for (var i = 0; i  var num=i+1;
        if (i == now) {
            thisli[i].className = "nav_li01hover";
            thisli[i].onmouseout = function() {
            this.className = "nav_li01hover";  
            }
        }
        else if(num%2==1) {
            thisli[i].className = "nav_li01";
        }else
{
thisli[i].className = "nav_li02";

}
    }
}
--------------------------
m.js文件:
var mcontainm=document.getElementById("menu-parent").getElementsByTagName("a");
var mcontains=document.getElementById("sub_box").getElementsByTagName("div");
for(var mi=0;mi mcontainm[mi].onmouseover=function(){mover(this.id.replace("par",""));}
mcontains[mi].onmouseover=function(){mover(this.id.replace("son",""));}
mcontainm[mi].onmouseout=function(){mout(this.id.replace("par",""));}
mcontains[mi].onmouseout=function(){mout(this.id.replace("son",""));}
}
if(def!=null){document.getElementById("par"+def).className="menuA";document.getElementById("son"+def).style.display="block";}


public.js文件很长 就不发了 但应该与它无关。

回复讨论(解决方案)

光看你这么长的代码,也没排好顺序,估计大家 都晕了……

已经自行解决了

sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan