Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
96
rated 0 times [  103] [ 7]  / answers: 1 / hits: 22209  / 13 Years ago, mon, july 11, 2011, 12:00:00

I am trying to find out the differences between style




  • hidden

  • block

  • none



I am trying with this example, but unfortunately this isn't working.
Could anybody please let me know the answer?



<html>
<head>
<title>JavaScript Unleashed</title>

<script>
function callMe()
{

document.getElementById('layer1').style.visibility = 'block';
}

</script>
</head>
<body onload=callMe()>


<div name=layer1>

<hr>DIV 1<hr>

</div>




</body>
</html>

More From » javascript

 Answers
24

You're really close. Two different properties.



display: (block || none) (there are more options here)
visibility: (visible || hidden)


The different is with display:none the element is completely hidden from the view. So if you have a box with 300px height and width then you would not see anything there.



With visibility:hidden it will keep the dimensions of the area, but will hide all the content.


[#91246] Saturday, July 9, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dustin

Total Points: 599
Total Questions: 105
Total Answers: 106

Location: Belarus
Member since Tue, Mar 14, 2023
1 Year ago
dustin questions
;