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

Q1134 How can I swap one image to the same highlighted image over many different links?

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

Try:

<script language="JavaScript"><!--
function swapOn() {
    if (document.images)
        document.imageName.src='image2.gif'
}

function swapOff() {
    if (document.images)
        document.imageName.src='image1.gif'
}
//--></script>

<img src="image1.gif" name="imageName" width="100" height="100">

<a href="page1.htm" onMouseOver="swapOn()" onMouseOut="swapOff()">text link 1</a>
<a href="page2.htm" onMouseOver="swapOn()" onMouseOut="swapOff()">text link 2</a>
<a href="page3.htm" onMouseOver="swapOn()" onMouseOut="swapOff()">text link 3</a>
<a href="page4.htm" onMouseOver="swapOn()" onMouseOut="swapOff()">text link 4</a>

©2018 Martin Webb