How to Hide a control but keep its space occupied?

Usually, to hide a control or a block in HTML, we can use the following JavaScript to set the style of the control or the block,

document.getElementById(“”).style.display=”none”;

or apply the following  css,  

.some-css-name

{

   display:none

But it will remove the space occupied by the control as well. If we want to keep the space, but only want to hide the control, we can use the following way,

document.getElementById(“”).style.visibility=”hidden”;

or

.some-css-name

{

   visibility:hidden;

}

BTW, the reverse function of the above is as below,

document.getElementById("").style.display="inline"

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

posted @ 2009-11-23 11:20  FangwenYu  阅读(213)  评论(0编辑  收藏  举报