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

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

irt.org | Knowledge Base | JavaScript | Image | Q327 [ previous next ]

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

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.