Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | DHTML | Q1420 [ previous next ]

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

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?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.