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

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>";

I don't kown why. but you have a obvius error here:

onmouseover='MM_swapImage('movieThumb','','http://cantankerousme.net/images/gallery/".$thumb."',1)'>

a uncorrect useage parsing of qutoe

you can try this:

echo "<a href='...' "."MM_swqpImage('movieThumb','http://cantankerousme.net/images/gallery/' ".$thumb.",1)>";

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.