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

Q1275 How can I hide a layer by clicking an image link within the layer?

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

Try:

<script language="JavaScript"><!--
function hide(id) {
    if (document.layers) {
        document.layers[id].visibility = 'hidden';
    }
    else if (document.all) {
        document.all[id].style.visibility = 'hidden';
    }
}

function show(id) {
    if (document.layers) {
        document.layers[id].visibility = 'visible';
    }
    else if (document.all) {
        document.all[id].style.visibility = 'visible';
    }
}
//--></script>

<p>
<a href="javascript:;" onClick="show('myId')">Show Layer</a>
</p>

<span ID="myId" STYLE="position:relative; visibility: hidden;">
<a href="javascript:;" onClick="window.hide('myId'); return false"><img src="file.gif"></a>
</span>

©2018 Martin Webb