zoukankan      html  css  js  c++  java
  • js实例2表框

    <style type="text/css">
    #caidan{
    500px; height:35px; border:1px solid #60F;

    }

    .xiang{
    100px;
    height:35px;
    text-align:center;
    line-height:35px;
    vertical-align:middle;
    float:left;
    }

    </style>
    </head>

    <body>

    <div id="caidan">
    <div class="xiang" onmouseover="huan(this)" >首页</div>
    <div class="xiang" onmouseover="huan(this)" >产品中心</div>
    <div class="xiang" onmouseover="huan(this)" >服务中心</div>
    <div class="xiang" onmouseover="huan(this)" >联系我们</div>
    </div>


    </body>
    <script type="text/javascript">
    function huan(a)
    {
    //将所有的项恢复原样式
    var d = document.getElementsByClassName("xiang");
    for(var i=0;i<d.length;i++)
    {
    d[i].style.backgroundColor="white";
    d[i].style.color = "black";
    }

    //换该元素的样式
    a.style.backgroundColor = "red";
    a.style.color = "white";
    }
    /*function huifu(a)
    {
    a.style.backgroundColor = "white";
    a.style.color = "black";
    }*/
    </script>

  • 相关阅读:
    typedef用法小结
    14种排序
    常用google产品
    去重排序
    双向链表
    IDEA上传一个项目到github
    IDEA上传一个项目到github
    Git的安装
    Hibernate 加载策略得总结
    hadoop -- fsck
  • 原文地址:https://www.cnblogs.com/qdlj/p/6188260.html
Copyright © 2011-2022 走看看