Monday, November 8, 2010

Javascript examples: style.display & style.visibility & .disabled

document.getElementById("pnlSearch").style.display = "block";
document.getElementById("pnlSearch").style.display = "none";

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

document.getElementById('btnSearch').disabled =false;
document.getElementById('btnSearch').disabled =true;

From http://stackoverflow.com/questions/133051/what-is-the-difference-between-visibilityhidden-and-displaynone : (See link for a short-but-great example) :
display:none means that the the tag in question will not appear on the page at all (although you can still interact with it through the dom). There will be no space allocated for it between the other tags. Visibility:hidden means that unlike display:none, the tag is not visible, but space is allocated for it on the page.

No comments:

Post a Comment

Followers

Blog Archive