Edgar Ehritt: Verschachteln von Quotes in PHP

Beitrag lesen

Hallo xylon,

echo "OnMouseOver=\"Tip('$slot_descr[$count]<br><br><img align=\'right\' src=\'./icons/del.png\' onclick=\'document.getElementById($count).style.background=none;\'>',TITLE, '$slot_name[$count]', DELAY, 1000, FOLLOWMOUSE, false, PADDING, 5,CLICKCLOSE,true,STICKY, true)\" onmouseout=\"UnTip()\"";

hopala...

Gliedere document.getElementById($count).style.background=none; in eine eigene Javascriptfunktion aus:

function problem(element){  
   document.getElementById(element).style.background="none";  
}

Somit würde die PHP-Ausgabe so aussehen:

echo "OnMouseOver=\"Tip('$slot_descr[$count]<br><br><img align=\'right\' src=\'./icons/del.png\' onclick=\'problem($count)\'>',TITLE, '$slot_name[$count]', DELAY, 1000, FOLLOWMOUSE, false, PADDING, 5,CLICKCLOSE,true,STICKY, true)\" onmouseout=\"UnTip()\"";

Ansonsten reicht auch schlichter Standard:

<element OnMouseOver="Tip('<?php echo $slot_descr[$count];?><br><br><img align=\'right\' src=\'./icons/del.png\' onclick=\'document.getElementById(<?php echo $count;?>).style.background=none;\'>',TITLE, '<?php echo $slot_name[$count];?>', DELAY, 1000, FOLLOWMOUSE, false, PADDING, 5,CLICKCLOSE,true,STICKY, true)" onmouseout="UnTip()";></element>[/code]

Gruß aus Berlin!
eddi