zoukankan      html  css  js  c++  java
  • JS 显示隐藏DIV

    JS关闭DIV

    HTML

    <div id="bar1"> 
        <p onclick="removeElement('bar1')">关闭</p>
    </div> 
    <div id="bar2">
        <p onclick="removeElement('bar2')">关闭</p>
    </div>
    

    JS

    <script type="text/javascript">
    function removeElement(id)
    {
    document.getElementById(id).style.display="none";
    }
    </script> 
    

    JS显示DIV

    <div onclick="showOtherDiv()" style="border:1px solid #fff">点击显示另一个div</div>
    <div id="otherDiv" style="display:none;border:1px solid red">点击后显示的div</div>
         
    <script type="text/javascript">
         
    function showOtherDiv(){
        //获取要显示的div对象
        var  otherDiv=document.getElementById('otherDiv');
        //显示
        otherDiv.style.display="block";
    }
             
    </script>
    
  • 相关阅读:
    border-color
    animation
    servlet injection analysis
    事务隔离级别
    write RE validation
    Filter
    Annotation
    Injector
    gradle的安装
    Build tool
  • 原文地址:https://www.cnblogs.com/caobiin/p/7651212.html
Copyright © 2011-2022 走看看