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

Q327 How can I place a delay between onMouseOut and the swapping back of the image?

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

Use the setTimeout() method with a delay in milliseconds:

<SCRIPT LANGUAGE="JavaScript"><!--
function swapImage(name,image) {
    document.images[name].src = image;
}
//--></SCRIPT>

<A HREF="apage.html" onMouseOver="swapImage('myImage','on.gif')"
 onMouseOut="setTimeout('swapImage(\'myImage\',\'off.gif\')',1000)">
<IMG SRC="off.gif" NAME="myImage" BORDER="0" WIDTH="16" HEIGHT="16"></a>

©2018 Martin Webb