Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1261 How can I make a layer visible by clicking on a textlink on the same page?

You are here: irt.org | FAQ | DHTML | Q1261 [ previous next ]

Try:

<html>

<head>

<script type="text/javascript" language="JavaScript"><!--
function toggle(object) {
  if (document.getElementById) {
    if (document.getElementById(object).style.visibility == 'visible')
      document.getElementById(object).style.visibility = 'hidden';
    else
      document.getElementById(object).style.visibility = 'visible';
  }

  else if (document.layers && document.layers[object] != null) {
    if (document.layers[object].visibility == 'visible' ||
        document.layers[object].visibility == 'show' )
      document.layers[object].visibility = 'hidden';
    else
      document.layers[object].visibility = 'visible';
  }

  else if (document.all) {
    if (document.all[object].style.visibility == 'visible')
      document.all[object].style.visibility = 'hidden';
    else
      document.all[object].style.visibility = 'visible';
  }

  return false;
}
//--></script>

<style type="text/css"><!--
.myStyle { position: absolute; visibility: hidden; }
//--></style>

</head>

<body>

<a href="#" onClick="toggle('myLayer1')">click me</a>

<div id="myLayer1" class="myStyle">

<table bgcolor="#ffffcc"><tr><td>
This text is hidden from view.<br>It is revealed when the link<br>is clicked
</td></tr></table>

</div>

</body>

</html>

Feedback on 'Q1261 How can I make a layer visible by clicking on a textlink on the same page?'

©2018 Martin Webb