View Full Version : Tooltip/Swap Image Restore Conflict - Help Needed

05-07-2009, 11:05 AM
I would like to know how to resolve an issue that I am having with some images. Basically I am using javascript tooltips on images AND swap image/restore. The tooltip shows up fine and the image swaps initially. But, the image doesn't restore on mouse out. Is there a way to fix this so I can use the swap image restore and the tool tip?

Here's the link to the page:


Essentially, I would like the blank iPhone image (the one that is there when you access the page initially) to restore when the mouse leaves a thumbnail.

This is the JS that is being used:

<style type="text/css">
img.c3 {border: none;}
h1.c2 {text-align: center}
div.c1 {text-align: center}
<style type="text/css">
#toolTipBox {
display: none;
padding: 0px;
font-size: 10px;
border: black solid 3px;
font-family: arial;
position: absolute;
background-color: #000000;
color: #FFFFFF;
<script type="text/javascript">
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Saul Salvatierra :: http://myarea.com.sapo.pt
with help from Ultimater :: http://ultimiacian.tripod.com */

var theObj="";

function toolTip(text,me) {

function updatePos() {
var ev=arguments[0]?arguments[0]:event;
var x=ev.clientX;
var y=ev.clientY;
document.getElementById('toolTipBox').style.top = y-2+diffY+document.body.scrollTop+ "px";
document.getElementById('toolTipBox').style.left = x-2+diffX+document.body.scrollLeft+"px";
function hideMe() {
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)

... and this is the html code for each thumbnail:

<td width="150" height="179" align="center" valign="top"><span id="toolTipBox" width="150"></span><a href="wallpaper/ip_wp_5/ip_wp_5_php.php"><img src="wallpaper/thumbs/ip_wp_5.jpg" name="thumb_5" width="119" height="179" border="2" class="border" id="thumb_5" onmouseover="toolTip('Street Art, Belfast',this);MM_swapImage('iphone_full','','wallpaper/rollover_images/ip_wp5_rollover.png',1)" onmouseout="MM_swapImgRestore()"></a>

I should say also that I am something of a newbie when it comes to this so I would greatly appreciate any help, and your patience.

Many thanks indeed.

05-07-2009, 11:57 AM