JavaScript DHTML/Style Layout/visibility
Change the visibility of an element
<html>
<head>
<title>CSS</title>
</head>
<body>
<h1 id="h1element">The Title</h1>
<p id="firstelement">The first element.</p>
<p id="secondelement">The second element.</p>
<script type = "text/javascript" >
var myPs = document.getElementsByTagName("p");
for (var i = 0; i < myPs.length; i++) {
document.write(myPs[i].style.visibility);
document.write("<BR>");
myPs[i].style.visibility = "hidden";
alert(myPs[i].style.visibility);
document.write("<BR>");
}
</script>
</body>
</html>
Hide an element through css
<html>
<head>
<title>CSS</title>
</head>
<body>
<h1 id="h1element">The Title</h1>
<p id="firstelement">The first element.</p>
<p id="secondelement">The second element.</p>
<script type = "text/javascript" >
var myPs = document.getElementsByTagName("p");
for (var i = 0; i < myPs.length; i++) {
myPs[i].style.visibility = "hidden";
}
</script>
</body>
</html>