zoukankan      html  css  js  c++  java
  • clearInterval() 函数详解

    定义和用法

    clearInterval() 方法可取消由 setInterval() 设置的 timeout。

    clearInterval() 方法的参数必须是由 setInterval() 返回的 ID 值。

    语法

    clearInterval(id_of_setinterval)
    参数 描述
    id_of_setinterval 由 setInterval() 返回的 ID 值。

    实例

    window.onload=function(){
    var aLi=document.getElementsByTagName('li');
    for(var i=0; i<aLi.length; i++){
    aLi[i].onmouseover=function(){
    var oSubNav=this.getElementsByTagName('ul')[0];
    if(oSubNav){
    var This=oSubNav;
    clearInterval(This.time);
    This.time=setInterval(function(){
    This.style.height=This.offsetHeight+16+"px";
    if(This.offsetHeight>=120)
    clearInterval(This.time);
    },30)
    }
    }
    //鼠标离开菜单,二级菜单动画收缩起来。
    aLi[i].onmouseout=function(){
    var oSubNav=this.getElementsByTagName('ul')[0];
    if(oSubNav){
    var This=oSubNav;
    clearInterval(This.time);
    This.time=setInterval(function(){
    This.style.height=This.offsetHeight-16+"px";
    if(This.offsetHeight<=0)
    clearInterval(This.time);
    },30)
    }
    }
    }
    }

  • 相关阅读:
    shell的格式化输出命令printf
    shell数组
    shell字符串
    shell注释
    shell运算符
    shell替换
    shell特殊变量
    shell变量
    linux修改主机名
    ssh免密码登录设置
  • 原文地址:https://www.cnblogs.com/milkytea/p/6599901.html
Copyright © 2011-2022 走看看