I'm trying to include the onmouseover function with an image using this.src='url' in a PHP array.
I don't know if there is another way to call the image source without using single quotes, because it closes the HTML in that line.
$botons = array(
array(
'dia'=>1,
'item'=>'<a href="#"><img src="/img/formula.png" onmouseover="this.src='/img/formula_over.png';" onmouseout="this.src='/img/formula.png';"></a>'
),
);
I think I've tried everything... Any ideas? Thank you.
You just need to ensure you escape the single quotes using backslashes:
$botons = array(
array(
'dia'=>1,
'item'=>'<a href="#"><img src="/img/formula.png" onmouseover="this.src=\'/img/formula_over.png\';" onmouseout="this.src=\'/img/formula.png\';"></a>'
),
);
Hope this helps!