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

Q952 How can I swap images using onMouseOver?

You are here: irt.org | FAQ | JavaScript | Image | Q952 [ previous next ]

Try the following simple 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) {
    if (document.images)
        document.images[image].src = eval(image + ext + ".src");
}
//--></script>

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

Feedback on 'Q952 How can I swap images using onMouseOver?'

©2018 Martin Webb