944,172 Members | Top Members by Rank

Ad:
Jun 8th, 2006
0

Help with SWAP IMAGE

Expand Post »
[html]<tr>
<td height="123" bgcolor="#FFFFFF"><table width="140" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#999999">
<tr>
<td width="65" bordercolor="#CCCCCC" bgcolor="#CCCCCC"><div align="center"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Phone Us','','basic_interface/symbols/phone_over.jpg',1)"><img src="basic_interface/symbols/phone.jpg" alt="Phone Us" name="Phone Us" width="40" height="40" border="0" id="Phone Us" onmouseover="MM_swapImage('detail','','basic_interface/symbols/phone_num.jpg',1)" onmouseout="MM_swapImgRestore()" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Phone us','','basic_interface/symbols/phone_over.gif',1)"></a></div></td>
<td width="69" bordercolor="#CCCCCC" bgcolor="#CCCCCC"><div align="center"><a href="mailto: sigsol@btconnect.com" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('email us','','basic_interface/symbols/email.jpg',1)"><img src="basic_interface/symbols/email_over.jpg" alt="Email Us" name="email us" width="40" height="40" border="0" id="email us" onmouseover="MM_swapImage('detail','','basic_interface/symbols/email_detail.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></div></td>
</tr>
<tr>
<td colspan="2" bordercolor="#CCCCCC" bgcolor="#CCCCCC"><img src="basic_interface/symbols/detail_out.jpg" alt="Rollover the phone or email symbol above and the detail will show here" name="detail" width="140" height="25" id="detail" /></td>
</tr>

</table></td>
</tr>[/html]


This is my code to onmouseover swap current image and and different image and then restore both images.

But when I you move the mouse out the "different" image doesn't swap restore. Please could somebody tell me why this is. I used dreamweaver to do this and it has never done this wrong before.

Thanks for your help.
Similar Threads
Reputation Points: 178
Solved Threads: 15
Nearly a Posting Virtuoso
roryt is offline Offline
1,282 posts
since Oct 2005
Jun 8th, 2006
0

Re: Help with SWAP IMAGE

Well.. you have a big mess there... use this it’s more simple…. I made it my self!

<script type="text/JavaScript">
function rollover_img (bi, im){ // 1 bi = id of the imagem you want to swap; 2 im = the image you want to display
document.getElementById(bi).src = im;
}
</script>

Paste this right before the </HEAD> tag.

Them the image were you want to start the rollover should be something like this..

<img src="1.png" name="Image2" width="161" height="150" border="0" id="Image2" onmouseover="rollover_img('detail','1.png'), rollover_img('Image2','1.png')" onmouseout="rollover_img('detail','2.png'), rollover_img('Image2','2.png')" />

And you are ready to go..
Last edited by migcosta; Jun 8th, 2006 at 5:35 pm.
Reputation Points: 41
Solved Threads: 5
Junior Poster
migcosta is offline Offline
105 posts
since May 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Site Layout and Usability Forum Timeline: Making Webpages that conform to the users resolution
Next Thread in Site Layout and Usability Forum Timeline: sitemap partially indexed





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC