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>
You’re really close. Two different properties.
The different is with
display:nonethe 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:hiddenit will keep the dimensions of the area, but will hide all the content.