zoukankan      html  css  js  c++  java
  • js,鼠标移入块控制另一块改变

    <script>
      var a=document.getElementsByTagName('li')    定义一个变量找到当前文档内的li。
      for(i=0;i<a.length;i=i+1){                                      for循环
       a[i].onmouseover=function(){                             鼠标移入时间触发
        this.style.color='red'                                          当前域字体颜色变为红
        this.style.background='white'                            当前域背景变为白
       }
      }
      for(i=0;i<a.length;i=i+1){                                   for循环
       a[i].onmouseout=function(){                            鼠标移出事件触发
        this.style.color='white'                                     字体样式变为白
        this.style.background='#424242'                   背景样式变为#424242
       }
      }
     </script>

  • 相关阅读:
    第 12 章 Docker Swarm
    第 1 章 虚拟化
    第 0 章 写在最前面
    第 11 章 日志管理
    第 11 章 日志管理
    第 11 章 日志管理
    第 11 章 日志管理
    第 11 章 日志管理
    第 11 章 日志管理
    第 11 章 日志管理
  • 原文地址:https://www.cnblogs.com/fw282204258/p/10079417.html
Copyright © 2011-2022 走看看