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

Q953 How can I swap images using onMouseOver when the image is contained with a Netscape layer?

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

Try the following code:

<script language="JavaScript"><!--
if (document.images) {
    imageoff = new Image();
    imageoff.src  = 'imageoff.jpg';
    imageon = new Image();
    imageon.src = 'imageon.jpg';
}

function change(image,ext,id) {
    if (document.layers)
        document.layers[id].document.images[image].src = eval(image + ext + ".src");
}
//--></script>

<layer id="id1">
<a href="nextpage.htm" onMouseOver="change('image','on','id1')" onMouseOut="change('image','off','id1')"><img name="image" src="imageoff.jpg" width="20" height="20" border="0" alt="Image"></a>
</layer>

©2018 Martin Webb