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

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

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

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

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>

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.