Hey echo '<li><a href="/game/' . $row['id'] .'/" onMouseover="ddrivetip(\'<img src=/' . $row['thumbnail'] . ' /><strong>test</strong>\',\'black\')"; onMouseout="hideddrivetip()">' . $row['title'] . '</a></li>'; PHP: I've got a tooltip when I hover a link and the PHP and JS are conflicting. At the moment I can't use any "s within the tooltip, which means I can style the tooltip contents properly. I want to put <img src="/' . $row['thumbnail'] . '" />' . $row['description'] . ' In the tooltip but it won't let me, I know why but I just can't see a work around because I don't usually work with JS. Thanks
Rewrite your code for easy of use and clarity: echo <<<eof <li><a href="/game/{$row['id']}/" onMouseover="ddrivetip('<img src=\\'/{$row['thumbnail']}\\' /><strong>test</strong>','black');" onMouseout="hideddrivetip()">{$row['title']}</a></li> eof; PHP: Try something on the lines of that. Jay
Thanks, that kind of works. I edited the code to this: echo <<<eof <li><a href="/game/{$row['id']}/" onMouseover="ddrivetip('<img src=\\'/{$row['thumbnail']}\\' style=\'float:left; border: 1px solid #fff; margin: 6px;\' />{$row['description']}','black', 150);" onMouseout="hideddrivetip()">{$row['title']}</a></li> eof; PHP: However, now the tooltips only show for some files...?
Oh, yeah, it does.. Can I use str_replace or something? EDIT: if(strpos($row['description'], "'")) { $row['description'] = str_replace("'", "", $row['description']); } PHP: Seems to work, but will anything other than a ' break it?
try using the HTML codes for special characters in your descriptions, like: & #39; for ' (without the space - it shows up as ' if i try to use the code without the space between the &) " for " etc. That should keep it from breaking. More info on special HTML entities here: http://htmlhelp.com/reference/html40/entities/special.html
Or addcslashes(), to leave double quotes as they are (They don't need to be escaped). $row['description'] = addcslashes($row['description'], "'"); PHP:
I agree with james. i think compination with HTML will make it lot easier. addslash() is new to me. thanks for this.