zoukankan      html  css  js  c++  java
  • 实现鼠标感应效果

     1<html>
     2<head>
     3<title></title>
     4<script language="javascript">
     5var min=10;
     6var max=100;
     7var number=1;
     8function OnMouseOver(obj)
     9{
    10  if(obj.changing)
    11    clearInterval(obj.changing);
    12  obj.changing=setInterval("add("+obj.id+")",10);
    13}

    14function OnMouseOut(obj)
    15{
    16  if(obj.changing)
    17    clearInterval(obj.changing);
    18  obj.changing=setInterval("sub("+obj.id+")",10);
    19}

    20function add(obj)
    21{
    22  if(obj.filters.Alpha.Opacity > max)
    23  {
    24    clearInterval(obj.changing);
    25    obj.changing=false;
    26    obj.filters.Alpha.Opacity = max;
    27  }

    28  else
    29    obj.filters.Alpha.Opacity += number;
    30  test1.innerText = "img1:"+img1.filters.Alpha.Opacity;
    31  test2.innerText = "img2:"+img2.filters.Alpha.Opacity;
    32}

    33function sub(obj)
    34{
    35  if(obj.filters.Alpha.Opacity < min)
    36  {
    37    clearInterval(obj.changing);
    38    obj.changing=false;
    39    obj.filters.Alpha.Opacity = min;
    40  }

    41  else
    42    obj.filters.Alpha.Opacity += -number;
    43  test1.innerText = "img1:"+img1.filters.Alpha.Opacity;
    44  test2.innerText = "img2:"+img2.filters.Alpha.Opacity;
    45}

    46
    </script>
    47</head>
    48<body>
    49<img id='img1' src="bt_search.gif" style="filter:Alpha(Opacity=10)" onmouseover="OnMouseOver(this)" onmouseout="OnMouseOut
    50
    51(this)">
    52<img id='img2' src="bt_search.gif" style="filter:Alpha(Opacity=10)" onmouseover="OnMouseOver(this)" onmouseout="OnMouseOut
    53
    54(this)">
    55<div id='test1'>img1:10</div>
    56<div id='test2'>img2:10</div>
    57</body>
    58</html>
  • 相关阅读:
    激活函数(ReLU, Swish, Maxout)
    损失函数
    md5sum命令行使用注意事项
    Jetson ARM SeetaFace编译
    Linux下的wine生活(QQ/微信/Office)
    人脸识别引擎SeetaFace编译 ubuntu
    Python为8bit深度图像应用color map
    MySQL、MongoDB、Redis数据库Docker镜像制作
    bash的管道符与重定向
    Docker 及 nvidia-docker 使用
  • 原文地址:https://www.cnblogs.com/Lewis/p/512000.html
Copyright © 2011-2022 走看看