首页 > 技术文章 > 元素的隐藏与显示与判断 js jquery aspx.cs

tianxiaoxiao 2017-11-23 08:48 原文

1.js

 隐藏后仍占空间

   document.getElementById('id').style.visibility="hidden";

   document.getElementById('id').style.visibility="visible";

    隐藏后不占空间

    document.getElementById('id').style.display="none";

    document.getElementById('id').style.display="inline";//线级  block块级

2.Jquery

  $('#id').hide(); //隐藏后不占空间

     $('#id').show();

   判断 

    $('#').is(':hidden')  //true 隐藏

    $('#').is(':visible')  //true 显示

3.aspx.cs        asp cs页面控制前台服务器空间的显示        

       asp类型控件                                                 this.id.Attributes["visible"]=false;

       html控件 runat="server" 属性在style中         this.id.Style["display"]="none"; //隐藏后不占空间

              

推荐阅读