Hidding and Showing Text

[Total: 0    Average: 0/5]

This file shows how to create a DIV that is hidden and have it appear upon command, and then disappear upon another command.

Head Code:

<script type=text/javascript>
var isNS = navigator.appName.indexOf("Netscape")  != -1
var isIE = navigator.appName.indexOf("Microsoft") != -1
function show() {
  if (isNS) document.layers["d1"].visibility = "show";
  if (isIE) document.all.d1.style.visibility = "visible";
}
function hide() {
  if (isNS) document.layers["d1"].visibility = "hide";
  if (isIE) document.all.d1.style.visibility = "hidden";
}
</script>

Body Code:

<a href="javascript:show()">CLICK ME TO SHOW MESSAGE</a>
<BR><BR>
<a href="javascript:hide()">CLICK ME TO HIDE MESSAGE</a>
<div id="d1" style="visibility:hidden;position:relative;top:10;left:10">
<B>Hidden Message</b>
</div>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *