I am trying to find out the differences between style
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With