急,在线等,购物导航条,现有一级分类不能高亮,求大侠帮忙看看!

dxc8 发布于 2012/11/05 18:09
阅读 159
收藏 0
急,在线等,购物导航条,现有一级分类不能高亮,求大侠帮忙看看!

玩转大学城下的-=》电脑办公 滑过不能高亮,感觉是js出的问题,帮帮忙!谢谢!!!


这是想要的效果,现在情况是鼠标滑过“电脑办公”不能停留在绿色高亮状态,要求的是这效果,大侠给我看看哪里出问题了,比较争,在线等,谢谢!!!

附源码:
<!DOCTYPE html>
<html>
<head>
<meta charset="gbk" />
<!--
作者:小爱大福
时间:2012年10月11号
 -->
<title>页面001</title>
<style type="text/css">
body{behavior:url(images/iehoverfix.htc);}
</style>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script src="js/excanvas/excanvas.js"></script>
<![endif]-->
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>


<script>
var timer;
var timer_num=175;

function getElementByTagAndClass(tag,className){
var uls=document.getElementsByTagName(tag);
for(var i=0;i<uls.length;i++){
if(uls[i].className==className){
return uls[i];
}
}
}

function jcb_menu_mouseover(){
//alert("鼠标移进");
clearTimeout(timer);
var obj=getElementByTagAndClass("ul","nav_menu_ul02");
obj.style.display="block";
}

function jcb_menu_mouseout(){
//alert("鼠标移出");

timer = setTimeout(function() {
var obj=getElementByTagAndClass("ul","nav_menu_ul02");
obj.style.display="none";
}, timer_num);
}
window.onload=function(){
var objli=getElementByTagAndClass("li","nav_menu_show");
var obj=getElementByTagAndClass("ul","nav_menu_ul02");

//alert(obj.className);

if(window.addEventListener){ // Mozilla, Netscape, Firefox
        objli.addEventListener('mouseover', function(){
//alert('Mozilla, Netscape, Firefox事件');

jcb_menu_mouseover();

}, false);

objli.addEventListener('mouseout', function(){
//alert('Mozilla, Netscape, Firefox事件');

jcb_menu_mouseout();

}, false);

    } else { // IE
        objli.attachEvent('onmouseover',  function(){
//alert("IE事件");
jcb_menu_mouseover();

});

objli.attachEvent('onmouseout',  function(){
//alert("IE事件");
jcb_menu_mouseout();

});

    }
};

function menu_mouseover(obj){
var divs=obj.getElementsByTagName("div");
for(var i=0;i<divs.length;i++){
if(divs[i].className=="nav_menu_list"){
divs[i].style.display="block";
}
}
}

function menu_mouseout(obj){
var divs=obj.getElementsByTagName("div");
for(var i=0;i<divs.length;i++){
if(divs[i].className=="nav_menu_list"){
divs[i].style.display="none";
}
}
}
</script>
<style>
* {
margin: 0px;
padding: 0px;
}
.nav {
width:800px;
height:40px;
background:#83b812;

}
.nav_menu_show {
position: relative;
z-index:1;

}

.nav_menu_ul01 li {
float:left;
height:40px;
line-height:40px;
list-style-type:none;
}

.nav_menu_ul01 li.nav_firstli{

}
.nav_menu_ul01 li.nav_firstli a{
display:block;
padding:0 15px;
font-size:1.2em;
color:#fff;
letter-spacing:1px;
}
.nav_menu_ul01 li.nav_home a{
background:#f90;
text-decoration:none;
font-weight:bold;
}
.nav_menu_ul01 li.nav_firstli a:hover{
background:#f90;
text-decoration:none;
font-weight:bold;
}

.nav_menu_show .pruduct_all {
display:block;
width:190px;
text-align:center;
font-size:1.2em;
font-weight:bold;
letter-spacing:1px;
}
.nav_menu_ul02 {
border:5px solid #83b812;
border-top:none;
display:none;
position: absolute;
top:40px;
left:0px;
width:180px;
background:#F9FFDD;
z-index:2;
}
.nav_menu_ul02 li {
height: 40px;
line-height: 40px;
letter-spacing:1px;
font-size:14px;
width:180px;
}
 .nav_menu_ul02 li .pruduct_fenlei1 a{
display:block;
padding: 0 0 0 25px;
width:155px;
background:#dedede;
}
 .nav_menu_ul02 li .pruduct_fenlei1 a:hover  {
display:block;
color:#fff;
background:#83b812;
} 
.nav_menu_list {
margin-top:1px;
background:#F9FFDD;
border: 5px solid #83b812;
width:400px;
display:none;
position: absolute;
top:0px;
left:180px;
}
</style>

</head>
<body>
  <div class="nav" >
    <ul class="nav_menu_ul01" >
      <li class="nav_menu_show"> <span class="pruduct_all">玩转大学城</span>
        <ul class="nav_menu_ul02">
          <li onMouseOver="menu_mouseover(this)" onMouseOut="menu_mouseout(this)"& gt;<span class="pruduct_fenlei1"><a href="#" >电脑办公</a& gt;</span>
            <div class="nav_menu_list"> 电脑办公电脑办公电脑办公 </div>
          </li>
          <li onMouseOver="menu_mouseover(this)" onMouseOut="menu_mouseout(this)"& gt;<span class="pruduct_fenlei1"><a href="#" >电脑办公</a& gt;</span>
            <div class="nav_menu_list"> 家用电器家用电器家用电器 </div>
          </li>
          <li onMouseOver="menu_mouseover(this)" onMouseOut="menu_mouseout(this)"& gt;<span class="pruduct_fenlei1"><a href="#" >电脑办公</a& gt;</span>
            <div class="nav_menu_list"> 电脑办公电脑办公电脑办公 </div>
          </li>
          <li onMouseOver="menu_mouseover(this)" onMouseOut="menu_mouseout(this)"& gt;<span class="pruduct_fenlei1"><a href="#" >电脑办公</a& gt;</span>
            <div class="nav_menu_list"> 家用电器家用电器家用电器 </div>
          </li>
        </ul>
      </li>
      <li class="nav_firstli nav_home"><a href="" title="" target="_blank">大学城首页</a></li>
      <li class="nav_firstli"><a href="#">店铺动态</a></li>
  <li class="nav_firstli"><a href="#">店铺动态</a></li>
  <li class="nav_firstli"><a href="#">店铺动态</a></li>
    </ul>
  </div>
</body>
</html>
加载中
0
迷路的游侠
迷路的游侠
建议你放到RunJs里,然后发个链接出来。大家看的清清爽爽,也乐意给你找找毛病
0
dxc8
dxc8
好,马上去试试
返回顶部
顶部