Kanon Chowdhury Kanon Chowdhury - 1 year ago 139
Javascript Question

onMOuseOver onMouseOut not working embeded with php

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


Here is my code:

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

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download