Jump to content

Trying to do a mouseover event within php "while"


kuyaRomeo

Recommended Posts

In a nutshell:

 

I am using Mysql to query a table, and bring back the results, then doing a php WHILE, and in that while I am placing an image for each record.  I want to do a swap image for another image . .  on this image.  So that is why it is done using "echo statements" and not raw html.

 

I have tested it in HTML and it works fine, but I must be missing something here:

 

<?

while($row = mysql_fetch_array($result2))
	{


		$thumb = $row['thumb'];


		$dirdesimage = $row['dir_des_image'];

		echo "<a href='http://mysite.net/director/vidpop.php?val1=". $vid ."'onclick='basicPopup(this.href);return false' onmouseout='MM_swapImgRestore()' onmouseover='MM_swapImage('movieThumb','','http://mysite.net/images/gallery/".$thumb."',1)'><img src='http://mysite/director/images/reel.png'></a>";






	}
	?>

 

When I mouse over the reel image above . . the other image does nothing.

 

This is the image that should be swapping out:

 

<?
echo "<a href='#' onmouseout='MM_swapImgRestore()' onmouseover='MM_swapImage('movieThumb','','http://cantankerousme.net/images/gallery/".$thumb."',1)'><img src='http://cantankerousme.net/images/gallery/OR_trailer_thumb.png' name='movieThumb' width='330' height='230' border='0' id='movieThumb' /></a></div>";
?>
</div>


 

This way, in plain HTML I am doing the same thing, basically and it is working.  I am using one image to control the swap out of another image and it works fine . .so what am I missing in the php echo statement ??

 

<div id="tester">
<a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('movieThumb','','../images/gallery/TTN_trlr_thumb.png',1)"><img src="../images/gallery/<? echo $thumb; ?>" name="Image5" width="330" height="230" border="0" id="Image5" /></a>
</div>

 

Thanks for your insight

Link to comment
Share on other sites

Try this

echo "<a href=\"http://mysite.net/director/vidpop.php?val1=". $vid ."\" onclick=\"basicPopup(this.href);return false\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('movieThumb','','http://mysite.net/images/gallery/".$thumb."',1)\"><img src=\"http://mysite/director/images/reel.png\"></a>";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.