I have this PHP code working, but I've been unsuccessful in getting an 'onclick' event to work.
echo '<div style="position:'.$row[12].'; left:'.$row[8].'px; top:'.$row[9].'px;"><img src="'.$row[2].'" onmouseover="this.src=\''.$row[3].'\';" onmouseout="this.src=\''.$row[2].'\';" ></a></div>';
I am using a custom image file as a button and it is working properly for 'onmouseover' and 'onmouseout' events.