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

Q982 In Netscape Navigator 4, how I do I swap two images in different layers?

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

Try the following:

<script language="JavaScript"><!--
function on() {
    if (document.layers) {
        window.document.layers['myLayer1'].document.images['myImage1'].src = 'imageon.jpg';
        window.document.layers['myLayer2'].document.images['myImage2'].src = 'imageon.jpg';
    }
}

function off() {
    if (document.layers) {
        window.document.layers['myLayer1'].document.images['myImage1'].src = 'imageoff.jpg';
        window.document.layers['myLayer2'].document.images['myImage2'].src = 'imageoff.jpg';
    }
}
//--></script>

<div id="myLayer1" style="position:absolute; left:100; top:50;">
<a href="nextpage.htm" onMouseOver="window.on()" onMouseOut="window.off()"><img src="imageoff.jpg" name="myImage1" width="40" height="40"></a>
</div>

<div id="myLayer2" style="position:absolute; left:50; top:100;">
<a href="nextpage.htm" onMouseOver="window.on()" onMouseOut="window.off()"><img src="imageoff.jpg" name="myImage2" width="40" height="40"></a>
</div>

©2018 Martin Webb