• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

请问为什么我这样写鼠标滑到二级菜单,他就给我缩回去了,不都是变量名吗?

动画菜单* { margin: 0; padding: 0; font-size: 14px; }a { color: #333; text-decoration: none }ul{ list-style: none; }.nav {height: 30px; border-bottom: 5px solid #F60; margin-left:50px; width:600px;}.nav li { float: left; position:relative; height:30px; width:120px }.nav li a { display: block; height: 30px; text-align: center; line-height: 30px; width:120px; background: #efefef; margin-left: 1px; }.subNav{ position:absolute; top:30px; left:0; width:120px; height:0; overflow:hidden}.subNav li a{ background:#ddd }.subNav li a:hover{ background:#efefef}<script>window.onload=function(){    var aLi=document.getElementsByTagName('li');        for(var i=0; i=120){                clearInterval(lala);            }        },30)                }        //鼠标离开菜单,二级菜单动画收缩起来。                                aLi.onmouseout=function(){              var This=this.getElementsByTagName('ul')[0];     clearInterval(lala)        var lala=setInterval(function(){            This.style.height=This.offsetHeight-16+"px";            if(This.offsetHeight=120){</p>                clearInterval(This.time);
            }
        },30)
                }
        //鼠标离开菜单,二级菜单动画收缩起来。               
                aLi.onmouseout=function(){     
         var This=this.getElementsByTagName('ul')[0];
     clearInterval(This.time)
        This.time=setInterval(function(){
            This.style.height=This.offsetHeight-16+"px";

            if(This.offsetHeight

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

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

使用道具 举报

全部参与1

你要搞清楚对象和元素的区别。

在this.time 里你的this是元素,等于在这个元素里面加上一个time
可以理解为
而lala是一个var出来的变量
这个变量装了setinterval这个定时器,可以理解为lala就是这个定时器本身。
这能一样吗?
如果你是从一个对象上扩展出来的time装入setinterval就不会出错。

使用道具 举报

发新帖

发布任务需求已有1031161位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!