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

Q1420 How do I make code compatiable with Mozilla/Netscape Navigator 5, so that I can show and hide layers in all supporting browsers?

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

The following has been tested in Netscape Navigator 4, Mozilla, Internet Explorer 4 and Internet Explorer 5:

<script language="JavaScript"><!--
function show(object) {
    if (document.getElementById && document.getElementById(object) != null)
         node = document.getElementById(object).style.visibility='visible';
    else if (document.layers && document.layers[object] != null)
        document.layers[object].visibility = 'visible';
    else if (document.all)
        document.all[object].style.visibility = 'visible';
}

function hide(object) {
    if (document.getElementById && document.getElementById(object) != null)
         node = document.getElementById(object).style.visibility='hidden';
    else if (document.layers && document.layers[object] != null)
        document.layers[object].visibility = 'hidden';
    else if (document.all)
         document.all[object].style.visibility = 'hidden';
}
//--></script>

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

<a href="javascript:;" onMouseOver="show('myLayer1')" onMouseOut="hide('myLayer1')">a text link</a>

<span id="myLayer1" class="myStyle">
<table bgcolor="#ffffcc"><tr><td>This text is initially hidden from view</td></tr></table>
</span>

Feedback on 'Q1420 How do I make code compatiable with Mozilla/Netscape Navigator 5, so that I can show and hide layers in all supporting browsers?'

©2018 Martin Webb