Kanon Chowdhury Kanon Chowdhury - 1 month ago 9
Javascript Question

onMOuseOver onMouseOut not working embeded with php

I am selecting two image from database and want to show them

onMOuseOver
and
onMouseOut
.

Here is my code:

<img onmouseover="this.src=' .$him[0]. '" onmouseout="this.src='.$image_full[0].'" src="'.$image_full[0].'" />

Answer

I'm not sure if you like php print html code or html print php code, in both cases, be carefull with ' and ":

PHP print html code:

echo '<img onmouseover="this.src=\'' .$him[0]. '\'" onmouseout="this.src=\''.$image_full[0].'\'" src="'.$image_full[0].'"  />';

HTML print PHP code:

<img onmouseover="this.src='<?php echo $him[0] ?>'" onmouseout="this.src='<?php echo $image_full[0] ?>'" src="'<?php echo $image_full[0] ?>'"  />

If you try html print php code, you need to save your html code as php code

Comments