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

Q606 What code do you need to swap images in tables?

irt.org | Knowledge Base | JavaScript | Table | Q606 [ previous next ]

Q606 What code do you need to swap images in tables?

Try something like:

<html>
<head>
<script language="JavaScript"><!--
function swapImage(name,image) {
    if (document.images)
        document.images[name].src = image;
}
//--></script>
</head>

<body>

<table><tr><td>
<a href="apage.html" onMouseOver="swapImage('myImage','on.gif')"  onMouseOut="swapImage('myImage','off.gif')"><img src="off.gif" name="myImage" border="0" width="16" height="16"></a>
</td><td>
<a href="bpage.html" onMouseOver="swapImage('myotherImage','on.gif')"  onMouseOut="swapImage('myotherImage','off.gif')"><img src="off.gif" name="myotherImage" border="0" width="16" height="16"></a>
</td></tr></table>

</body>
</html>

Feedback on 'Q606 What code do you need to swap images in tables?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


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