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

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

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

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

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>

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.